Changeset 8777 for OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp
- Timestamp:
- 08/18/08 17:08:04 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp
r7892 r8777 33 33 #include <osg/PrimitiveSet> 34 34 #include <osg/Endian> 35 #include <osg/BlendFunc> 36 #include <osg/BlendEquation> 35 37 36 38 #include <osgDB/Registry> … … 746 748 float /*xSize*/, float /*ySize*/, float /*zSize*/, 747 749 float /*xMultiplier*/, float /*yMultiplier*/, float /*zMultiplier*/, 748 unsigned int /*numSlices*/=500, float /*sliceEnd*/=1.0f, float alphaFuncValue=0.02f )750 unsigned int /*numSlices*/=500, float /*sliceEnd*/=1.0f, float alphaFuncValue=0.02f, bool maximumIntensityProjection = false) 749 751 { 750 752 osg::Geode* geode = new osg::Geode; … … 864 866 stateset->setMode(GL_CULL_FACE, osg::StateAttribute::ON); 865 867 868 if (maximumIntensityProjection) 869 { 870 stateset->setAttribute(new osg::BlendFunc(osg::BlendFunc::ONE, osg::BlendFunc::ONE)); 871 stateset->setAttribute(new osg::BlendEquation(osg::BlendEquation::RGBA_MAX)); 872 } 873 866 874 { 867 875 osg::Geometry* geom = new osg::Geometry; … … 944 952 float xSize, float ySize, float zSize, 945 953 float xMultiplier, float yMultiplier, float zMultiplier, 946 unsigned int numSlices=500, float sliceEnd=1.0f, float alphaFuncValue=0.02f )954 unsigned int numSlices=500, float sliceEnd=1.0f, float alphaFuncValue=0.02f, bool maximumIntensityProjection = false) 947 955 { 948 956 bool two_pass = normalmap_3d.valid() && (image_3d->getPixelFormat()==GL_RGB || image_3d->getPixelFormat()==GL_RGBA); … … 1022 1030 material->setDiffuse(osg::Material::FRONT_AND_BACK,osg::Vec4(1.0f,1.0f,1.0f,1.0f)); 1023 1031 stateset->setAttributeAndModes(material); 1032 1033 if (maximumIntensityProjection) 1034 { 1035 stateset->setAttribute(new osg::BlendFunc(osg::BlendFunc::ONE, osg::BlendFunc::ONE)); 1036 stateset->setAttribute(new osg::BlendEquation(osg::BlendEquation::RGBA_MAX)); 1037 } 1024 1038 1025 1039 osg::Vec3 lightDirection(1.0f,-1.0f,1.0f); … … 1435 1449 arguments.getApplicationUsage()->addCommandLineOption("--images [filenames]","Specify a stack of 2d images to build the 3d volume from."); 1436 1450 arguments.getApplicationUsage()->addCommandLineOption("--shader","Use OpenGL Shading Language."); 1451 arguments.getApplicationUsage()->addCommandLineOption("--mip","Use Maximum Intensity Projection (MIP) filtering."); 1437 1452 arguments.getApplicationUsage()->addCommandLineOption("--xSize <size>","Relative width of rendered brick."); 1438 1453 arguments.getApplicationUsage()->addCommandLineOption("--ySize <size>","Relative length of rendered brick."); … … 1483 1498 bool createNormalMap = false; 1484 1499 while (arguments.read("-n")) createNormalMap=true; 1500 1501 bool maximumIntensityProjection = false; 1502 while(arguments.read("--mip")) maximumIntensityProjection = true; 1485 1503 1486 1504 float xSize=1.0f, ySize=1.0f, zSize=1.0f; … … 1599 1617 xSize, ySize, zSize, 1600 1618 xMultiplier, yMultiplier, zMultiplier, 1601 numSlices, sliceEnd, alphaFunc );1619 numSlices, sliceEnd, alphaFunc, maximumIntensityProjection); 1602 1620 } 1603 1621 else … … 1607 1625 xSize, ySize, zSize, 1608 1626 xMultiplier, yMultiplier, zMultiplier, 1609 numSlices, sliceEnd, alphaFunc );1627 numSlices, sliceEnd, alphaFunc, maximumIntensityProjection); 1610 1628 } 1611 1629
