Changeset 9793 for OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp
- Timestamp:
- 02/19/09 15:24:10 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp
r9748 r9793 891 891 while (arguments.read("--light")) shadingModel = Light; 892 892 893 float xSize= 1.0f, ySize=1.0f, zSize=1.0f;893 float xSize=0.0f, ySize=0.0f, zSize=0.0f; 894 894 while (arguments.read("--xSize",xSize)) {} 895 895 while (arguments.read("--ySize",ySize)) {} 896 896 while (arguments.read("--zSize",zSize)) {} 897 898 float xMultiplier=1.0f, yMultiplier=1.0f, zMultiplier=1.0f;899 while (arguments.read("--xMultiplier",xMultiplier)) {}900 while (arguments.read("--yMultiplier",yMultiplier)) {}901 while (arguments.read("--zMultiplier",zMultiplier)) {}902 897 903 898 osg::ref_ptr<TestSupportOperation> testSupportOperation = new TestSupportOperation; … … 1124 1119 1125 1120 Images::iterator sizeItr = images.begin(); 1126 xSize= (*sizeItr)->s();1127 ySize= (*sizeItr)->t();1128 zSize= (*sizeItr)->r();1121 int image_s = (*sizeItr)->s(); 1122 int image_t = (*sizeItr)->t(); 1123 int image_r = (*sizeItr)->r(); 1129 1124 ++sizeItr; 1130 1125 1131 1126 for(;sizeItr != images.end(); ++sizeItr) 1132 1127 { 1133 if ((*sizeItr)->s() != xSize||1134 (*sizeItr)->t() != ySize||1135 (*sizeItr)->r() != zSize)1128 if ((*sizeItr)->s() != image_s || 1129 (*sizeItr)->t() != image_t || 1130 (*sizeItr)->r() != image_r) 1136 1131 { 1137 1132 std::cout<<"Images in sequence are not of the same dimensions."<<std::endl; … … 1141 1136 1142 1137 1143 osg::RefMatrix* matrix = dynamic_cast<osg::RefMatrix*>(images.front()->getUserData()); 1138 osg::ref_ptr<osg::RefMatrix> matrix = dynamic_cast<osg::RefMatrix*>(images.front()->getUserData()); 1139 1140 if (!matrix) 1141 { 1142 if (xSize==0.0) xSize = static_cast<float>(image_s); 1143 if (ySize==0.0) ySize = static_cast<float>(image_t); 1144 if (zSize==0.0) zSize = static_cast<float>(image_r); 1145 1146 matrix = new osg::RefMatrix(xSize, 0.0, 0.0, 0.0, 1147 0.0, ySize, 0.0, 0.0, 1148 0.0, 0.0, zSize, 0.0, 1149 0.0, 0.0, 0.0, 1.0); 1150 } 1144 1151 1145 1152 osg::Vec4 minValue(FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX); … … 1273 1280 osg::ref_ptr<osgVolume::Layer> layer = new osgVolume::ImageLayer(image_3d.get()); 1274 1281 1275 if (matrix) 1276 { 1277 osgVolume::Locator* locator = new osgVolume::Locator(*matrix); 1278 layer->setLocator(locator); 1279 tile->setLocator(locator); 1280 } 1282 osgVolume::Locator* locator = new osgVolume::Locator(*matrix); 1283 layer->setLocator(locator); 1284 tile->setLocator(locator); 1281 1285 1282 1286 tile->setLayer(layer.get());
