Show
Ignore:
Timestamp:
06/03/11 17:58:36 (4 years ago)
Author:
robert
Message:

Added support for --tf-255 transfer function files

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp

    r12255 r12486  
    843843 
    844844 
    845 osg::TransferFunction1D* readTransferFunctionFile(const std::string& filename) 
     845osg::TransferFunction1D* readTransferFunctionFile(const std::string& filename, float colorScale=1.0f) 
    846846{ 
    847847    std::string foundFile = osgDB::findDataFile(filename); 
     
    863863        { 
    864864            std::cout<<"value = "<<value<<" ("<<red<<", "<<green<<", "<<blue<<", "<<alpha<<")"<<std::endl; 
    865             colorMap[value] = osg::Vec4(red,green,blue,alpha); 
     865            colorMap[value] = osg::Vec4(red*colorScale,green*colorScale,blue*colorScale,alpha*colorScale); 
    866866        } 
    867867    } 
     
    10521052        transferFunction = readTransferFunctionFile(tranferFunctionFile); 
    10531053    } 
     1054    while (arguments.read("--tf-255",tranferFunctionFile)) 
     1055    { 
     1056        transferFunction = readTransferFunctionFile(tranferFunctionFile,1.0f/255.0f); 
     1057    } 
    10541058 
    10551059    while(arguments.read("--test"))