Improvements to new MultipassTechnique

This commit is contained in:
Robert Osfield 2013-12-09 10:39:01 +00:00
parent 3858acf70f
commit 499adba97f
2 changed files with 13 additions and 2 deletions

View File

@ -227,8 +227,13 @@ void MultipassTechnique::init()
osg::ref_ptr<osg::Texture3D> texture3D = new osg::Texture3D; osg::ref_ptr<osg::Texture3D> texture3D = new osg::Texture3D;
{ {
osg::Texture::InternalFormatMode internalFormatMode = osg::Texture::USE_IMAGE_DATA_FORMAT; osg::Texture::InternalFormatMode internalFormatMode = osg::Texture::USE_IMAGE_DATA_FORMAT;
#if 1
osg::Texture::FilterMode minFilter = osg::Texture::LINEAR; osg::Texture::FilterMode minFilter = osg::Texture::LINEAR;
osg::Texture::FilterMode magFilter = osg::Texture::LINEAR; osg::Texture::FilterMode magFilter = osg::Texture::LINEAR;
#else
osg::Texture::FilterMode minFilter = osg::Texture::NEAREST;
osg::Texture::FilterMode magFilter = osg::Texture::NEAREST;
#endif
// set up the 3d texture itself, // set up the 3d texture itself,
// note, well set the filtering up so that mip mapping is disabled, // note, well set the filtering up so that mip mapping is disabled,
@ -255,8 +260,11 @@ void MultipassTechnique::init()
stateset->setTextureAttributeAndModes(volumeTextureUnit, texture3D, osg::StateAttribute::ON); stateset->setTextureAttributeAndModes(volumeTextureUnit, texture3D, osg::StateAttribute::ON);
osg::Uniform* baseTextureSampler = new osg::Uniform("volumeTexture", int(volumeTextureUnit)); osg::ref_ptr<osg::Uniform> baseTextureSampler = new osg::Uniform("volumeTexture", int(volumeTextureUnit));
stateset->addUniform(baseTextureSampler); stateset->addUniform(baseTextureSampler.get());
osg::ref_ptr<osg::Uniform> volumeCellSize = new osg::Uniform("volumeCellSize", osg::Vec3(1.0f/static_cast<float>(image_3d->s()),1.0f/static_cast<float>(image_3d->t()),1.0f/static_cast<float>(image_3d->r())));
stateset->addUniform(volumeCellSize.get());
} }

View File

@ -87,6 +87,9 @@ void VolumeScene::tileVisited(osg::NodeVisitor* nv, osgVolume::VolumeTile* tile)
tileData->modelviewMatrix = cv->getModelViewMatrix(); tileData->modelviewMatrix = cv->getModelViewMatrix();
viewData->_tiles.push_back(tileData.get()); viewData->_tiles.push_back(tileData.get());
} }
osg::BoundingBox bb(0.0f,0.0f,0.0f,1.0f,1.0f,1.0f);
cv->updateCalculatedNearFar(*(cv->getModelViewMatrix()),bb);
} }
} }