Added TerrainNode::setColorFilter(layerNum,Filter) to allow developers to set

what type of texture filter to use, either LINEAER and NEAREST.
This commit is contained in:
Robert Osfield
2007-04-30 09:47:35 +00:00
parent 43e6d7e879
commit efb52dfab9
4 changed files with 64 additions and 1 deletions

View File

@@ -49,6 +49,7 @@ void GeometryTechnique::init()
osgTerrain::Layer* elevationLayer = _terrainNode->getElevationLayer();
osgTerrain::Layer* colorLayer = _terrainNode->getColorLayer(0);
osg::TransferFunction* colorTF = _terrainNode->getColorTransferFunction(0);
osgTerrain::TerrainNode::Filter filter = _terrainNode->getColorFilter(0);
// if the elevationLayer and colorLayer are the same, and there is colorTF then
// simply assing as a texture coordinate.
@@ -286,6 +287,8 @@ void GeometryTechnique::init()
texture2D->setResizeNonPowerOfTwoHint(false);
stateset->setTextureAttributeAndModes(color_index, texture2D, osg::StateAttribute::ON);
texture2D->setFilter(osg::Texture::MAG_FILTER, filter==TerrainNode::LINEAR ? osg::Texture::LINEAR : osg::Texture::NEAREST);
if (tf)
{
// up the precision of hte internal texture format to its maximum.

View File

@@ -81,6 +81,13 @@ void TerrainNode::setColorTransferFunction(unsigned int i, osg::TransferFunction
_colorLayers[i].transferFunction = tf;
}
void TerrainNode::setColorFilter(unsigned int i, Filter filter)
{
if (_colorLayers.size() <= i) _colorLayers.resize(i+1);
_colorLayers[i].filter = filter;
}
osg::BoundingSphere TerrainNode::computeBound() const
{
osg::BoundingSphere bs;