Added support for --tf-255 transfer function files

This commit is contained in:
Robert Osfield
2011-06-03 15:58:36 +00:00
parent 985fdc8965
commit b0ca6de657

View File

@@ -842,7 +842,7 @@ osg::Image* doColourSpaceConversion(ColourSpaceOperation op, osg::Image* image,
}
osg::TransferFunction1D* readTransferFunctionFile(const std::string& filename)
osg::TransferFunction1D* readTransferFunctionFile(const std::string& filename, float colorScale=1.0f)
{
std::string foundFile = osgDB::findDataFile(filename);
if (foundFile.empty())
@@ -862,7 +862,7 @@ osg::TransferFunction1D* readTransferFunctionFile(const std::string& filename)
if (fin)
{
std::cout<<"value = "<<value<<" ("<<red<<", "<<green<<", "<<blue<<", "<<alpha<<")"<<std::endl;
colorMap[value] = osg::Vec4(red,green,blue,alpha);
colorMap[value] = osg::Vec4(red*colorScale,green*colorScale,blue*colorScale,alpha*colorScale);
}
}
@@ -1051,6 +1051,10 @@ int main( int argc, char **argv )
{
transferFunction = readTransferFunctionFile(tranferFunctionFile);
}
while (arguments.read("--tf-255",tranferFunctionFile))
{
transferFunction = readTransferFunctionFile(tranferFunctionFile,1.0f/255.0f);
}
while(arguments.read("--test"))
{