Changeset 9618 for OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp
- Timestamp:
- 02/02/09 15:43:27 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp
r9613 r9618 717 717 std::cout<<"Reading transfer function "<<filename<<std::endl; 718 718 719 osg::TransferFunction1D:: ValueMap valueMap;719 osg::TransferFunction1D::ColorMap colorMap; 720 720 osgDB::ifstream fin(foundFile.c_str()); 721 721 while(fin) … … 726 726 { 727 727 std::cout<<"value = "<<value<<" ("<<red<<", "<<green<<", "<<blue<<", "<<alpha<<")"<<std::endl; 728 valueMap[value] = osg::Vec4(red,green,blue,alpha);729 } 730 } 731 732 if ( valueMap.empty())728 colorMap[value] = osg::Vec4(red,green,blue,alpha); 729 } 730 } 731 732 if (colorMap.empty()) 733 733 { 734 734 std::cout<<"Error: No values read from transfer function file: "<<filename<<std::endl; … … 737 737 738 738 osg::TransferFunction1D* tf = new osg::TransferFunction1D; 739 tf->assign( valueMap, true);739 tf->assign(colorMap); 740 740 741 741 return tf; … … 852 852 transferFunction = readTransferFunctionFile(tranferFunctionFile); 853 853 } 854 855 while(arguments.read("--test")) 856 { 857 transferFunction = new osg::TransferFunction1D; 858 transferFunction->setColor(0.0, osg::Vec4(1.0,0.0,0.0,0.0)); 859 transferFunction->setColor(0.5, osg::Vec4(1.0,1.0,0.0,0.5)); 860 transferFunction->setColor(1.0, osg::Vec4(0.0,0.0,1.0,1.0)); 861 } 862 863 while(arguments.read("--test2")) 864 { 865 transferFunction = new osg::TransferFunction1D; 866 transferFunction->setColor(0.0, osg::Vec4(1.0,0.0,0.0,0.0)); 867 transferFunction->setColor(0.5, osg::Vec4(1.0,1.0,0.0,0.5)); 868 transferFunction->setColor(1.0, osg::Vec4(0.0,0.0,1.0,1.0)); 869 transferFunction->assign(transferFunction->getColorMap()); 870 } 854 871 855 872 unsigned int numSlices=500; … … 976 993 if (fin) 977 994 { 978 osg::TransferFunction1D:: ValueMap valueMap;995 osg::TransferFunction1D::ColorMap colorMap; 979 996 float value = 0.0; 980 997 while(fin && value<=1.0) … … 984 1001 if (fin) 985 1002 { 986 valueMap[value] = osg::Vec4(red/255.0f,green/255.0f,blue/255.0f,alpha/255.0f);1003 colorMap[value] = osg::Vec4(red/255.0f,green/255.0f,blue/255.0f,alpha/255.0f); 987 1004 std::cout<<"value = "<<value<<" ("<<red<<", "<<green<<", "<<blue<<", "<<alpha<<")"; 988 std::cout<<" ("<< valueMap[value]<<")"<<std::endl;1005 std::cout<<" ("<<colorMap[value]<<")"<<std::endl; 989 1006 } 990 1007 value += 1/255.0; 991 1008 } 992 1009 993 if ( valueMap.empty())1010 if (colorMap.empty()) 994 1011 { 995 1012 std::cout<<"Error: No values read from transfer function file: "<<transfer_filename<<std::endl; … … 998 1015 999 1016 transferFunction = new osg::TransferFunction1D; 1000 transferFunction->assign( valueMap, true);1017 transferFunction->assign(colorMap); 1001 1018 } 1002 1019 }
