本文整理汇总了C++中ImageLayer::getTexelScale方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageLayer::getTexelScale方法的具体用法?C++ ImageLayer::getTexelScale怎么用?C++ ImageLayer::getTexelScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageLayer
的用法示例。
在下文中一共展示了ImageLayer::getTexelScale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
//.........这里部分代码省略.........
texture3D->setWrap(osg::Texture3D::WRAP_S,osg::Texture3D::CLAMP_TO_BORDER);
texture3D->setWrap(osg::Texture3D::WRAP_T,osg::Texture3D::CLAMP_TO_BORDER);
texture3D->setBorderColor(osg::Vec4(0.0,0.0,0.0,0.0));
if (image_3d->getPixelFormat()==GL_ALPHA ||
image_3d->getPixelFormat()==GL_LUMINANCE)
{
texture3D->setInternalFormatMode(osg::Texture3D::USE_USER_DEFINED_FORMAT);
texture3D->setInternalFormat(GL_INTENSITY);
}
else
{
texture3D->setInternalFormatMode(internalFormatMode);
}
texture3D->setImage(image_3d);
stateset->setTextureAttributeAndModes(0,texture3D,osg::StateAttribute::ON);
osg::Uniform* baseTextureSampler = new osg::Uniform("baseTexture",0);
stateset->addUniform(baseTextureSampler);
}
bool enableBlending = false;
if (tf)
{
float tfScale = 1.0f;
float tfOffset = 0.0f;
ImageLayer* imageLayer = dynamic_cast<ImageLayer*>(_volumeTile->getLayer());
if (imageLayer)
{
tfOffset = (imageLayer->getTexelOffset()[3] - tf->getMinimum()) / (tf->getMaximum() - tf->getMinimum());
tfScale = imageLayer->getTexelScale()[3] / (tf->getMaximum() - tf->getMinimum());
}
else
{
tfOffset = -tf->getMinimum() / (tf->getMaximum()-tf->getMinimum());
tfScale = 1.0f / (tf->getMaximum()-tf->getMinimum());
}
osg::ref_ptr<osg::Texture1D> tf_texture = new osg::Texture1D;
tf_texture->setImage(tf->getImage());
tf_texture->setResizeNonPowerOfTwoHint(false);
tf_texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR);
tf_texture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
tf_texture->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP_TO_EDGE);
stateset->setTextureAttributeAndModes(1, tf_texture.get(), osg::StateAttribute::ON);
stateset->addUniform(new osg::Uniform("tfTexture",1));
stateset->addUniform(new osg::Uniform("tfOffset",tfOffset));
stateset->addUniform(new osg::Uniform("tfScale",tfScale));
}
if (shadingModel==MaximumIntensityProjection)
{
enableBlending = true;
if (tf)
{
osg::ref_ptr<osg::Shader> fragmentShader = osgDB::readRefShaderFile(osg::Shader::FRAGMENT, "shaders/volume_tf_mip.frag");
if (fragmentShader.valid())
{
program->addShader(fragmentShader.get());
}