VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
makVrv::DtOsgTexturizer Class Reference

OpenSceneGraph implementation of terrain texturing. More...

Public Member Functions

 DtOsgTexturizer (DtDe &de)
virtual void drapeTexture (osg::Node *node, const std::string &definition, int textureunit=0)
 Project a texture over the terrain, scaled to the model The projection is isometric down the Z axis so maps nicely to terrain that is nearly an XY plane.
virtual void drapeTexture (osg::Node *node, const std::string &definition, const std::vector< double > &scale, const std::vector< double > &offset, osg::TexEnv::Mode blendmode=osg::TexEnv::MODULATE, osg::Texture::WrapMode wrapMode=osg::Texture::REPEAT, int textureunit=0)
 Project a texture over the terrain, scaled to the model The projection is isometric down the Z axis so maps nicely to terrain that is nearly an XY plane.
virtual void colorizeByElevation (osg::Node *node, const std::string &definition, int textureunit=0)
 Colorize a terrain using a specified gradient When scale and offset are 0.0, the gradient is stretched to match the terrain such that 0 in terrain-local coordinates represents the midpoint of the gradient.
virtual void drawContours (osg::Node *node, const std::string &definition, int textureunit=0)
 Project a repeating contour texture over the terrain The projection is isometric down the Z axis.
virtual void enableAutoTexturing (osg::Node *node)
 Recursively exempt anything under node that should not be texturized.
virtual void blankMaterial (osg::Node *node, int minunit=0, int maxunit=3)
 Replace current material with a blank white material suitable for texturing.
virtual void defaultDrapeParameters (osg::Node *node, const std::string &definition, double &xScale, double &yScale, double &xOffset, double &yOffset, osg::Texture::WrapMode &wrapMode, osg::TexEnv::Mode &blendMode)
 The scale and offset to entirely cover the terrain.
virtual void reset (osg::Node *node, int minunit=0, int maxunit=3)
 Resets matrices.
virtual void resetUnit (osg::Node *node, int unit)
 Resets texture unit.

Protected Member Functions

osg::Image * createGradientImageRGBA (const std::string &def, int resolution=256)
virtual void graphBoundingBox (const osg::Node *node, osg::BoundingBox &bbox) const
 Change bbox to fit node and every child of node.
virtual void project2dTexture (osg::Node *node, const std::string &texdef, const osg::Matrix &mat, osg::Texture::WrapMode wrapmode, osg::TexEnv::Mode blendmode, unsigned int texunit)
 Project texture texdef onto node using generated coordinates, using texture matrix mat.
virtual
osgDB::ReaderWriter::Options * 
setupTerrainReadImageOptions ()
 Turn off cache acceleration for texturizer images since they get alpha inserted (need no compression, no mip map)
virtual void project1dTexture (osg::Node *node, const std::string &texdef, const osg::Matrix &mat, osg::Texture::WrapMode wrapmode, osg::TexEnv::Mode blendmode, unsigned int texunit)
 Project texture texdef onto node using generated coordinates, using texture matrix mat.
virtual void rescaleTexture (osg::Node *node, const osg::Matrix &mat, osg::TexEnv::Mode blendmode, unsigned int texunit)
 rescale texture on node using generated coordinates and texture matrix mat
virtual bool isNameTextureExempt (const std::string &name) const
 Returns true if name describes something that should not be texturized (trees, etc.)
virtual osg::Image * convertImageToRGBA (osg::Image *img)
 Converts a RGB image to an RGBA image. Frees image that is passed in.

Protected Attributes

DtDemyDe

Detailed Description

OpenSceneGraph implementation of terrain texturing.

Constructor & Destructor Documentation

makVrv::DtOsgTexturizer::DtOsgTexturizer ( DtDe de)

Member Function Documentation

virtual void makVrv::DtOsgTexturizer::drapeTexture ( osg::Node *  node,
const std::string &  definition,
int  textureunit = 0 
)
virtual

Project a texture over the terrain, scaled to the model The projection is isometric down the Z axis so maps nicely to terrain that is nearly an XY plane.

virtual void makVrv::DtOsgTexturizer::drapeTexture ( osg::Node *  node,
const std::string &  definition,
const std::vector< double > &  scale,
const std::vector< double > &  offset,
osg::TexEnv::Mode  blendmode = osg::TexEnv::MODULATE,
osg::Texture::WrapMode  wrapMode = osg::Texture::REPEAT,
int  textureunit = 0 
)
virtual

Project a texture over the terrain, scaled to the model The projection is isometric down the Z axis so maps nicely to terrain that is nearly an XY plane.

virtual void makVrv::DtOsgTexturizer::colorizeByElevation ( osg::Node *  node,
const std::string &  definition,
int  textureunit = 0 
)
virtual

Colorize a terrain using a specified gradient When scale and offset are 0.0, the gradient is stretched to match the terrain such that 0 in terrain-local coordinates represents the midpoint of the gradient.

virtual void makVrv::DtOsgTexturizer::drawContours ( osg::Node *  node,
const std::string &  definition,
int  textureunit = 0 
)
virtual

Project a repeating contour texture over the terrain The projection is isometric down the Z axis.

If scale is 0 (the default), the contour texture will scale to 1/20 of the total height.

virtual void makVrv::DtOsgTexturizer::enableAutoTexturing ( osg::Node *  node)
virtual

Recursively exempt anything under node that should not be texturized.

This should be done once before using any of the automatic texturing functions (drapeTexture, colorizeByElevation, etc.) and will prevent texturing on detectable non-terrain elements. Calling this more than once is harmless, but it can be time-consuming for large terrain.

virtual void makVrv::DtOsgTexturizer::blankMaterial ( osg::Node *  node,
int  minunit = 0,
int  maxunit = 3 
)
virtual

Replace current material with a blank white material suitable for texturing.

virtual void makVrv::DtOsgTexturizer::defaultDrapeParameters ( osg::Node *  node,
const std::string &  definition,
double xScale,
double yScale,
double xOffset,
double yOffset,
osg::Texture::WrapMode &  wrapMode,
osg::TexEnv::Mode &  blendMode 
)
virtual

The scale and offset to entirely cover the terrain.

virtual void makVrv::DtOsgTexturizer::reset ( osg::Node *  node,
int  minunit = 0,
int  maxunit = 3 
)
virtual

Resets matrices.

virtual void makVrv::DtOsgTexturizer::resetUnit ( osg::Node *  node,
int  unit 
)
virtual

Resets texture unit.

osg::Image* makVrv::DtOsgTexturizer::createGradientImageRGBA ( const std::string &  def,
int  resolution = 256 
)
protected
virtual void makVrv::DtOsgTexturizer::graphBoundingBox ( const osg::Node *  node,
osg::BoundingBox &  bbox 
) const
protectedvirtual

Change bbox to fit node and every child of node.

virtual void makVrv::DtOsgTexturizer::project2dTexture ( osg::Node *  node,
const std::string &  texdef,
const osg::Matrix &  mat,
osg::Texture::WrapMode  wrapmode,
osg::TexEnv::Mode  blendmode,
unsigned int  texunit 
)
protectedvirtual

Project texture texdef onto node using generated coordinates, using texture matrix mat.

virtual osgDB::ReaderWriter::Options* makVrv::DtOsgTexturizer::setupTerrainReadImageOptions ( )
protectedvirtual

Turn off cache acceleration for texturizer images since they get alpha inserted (need no compression, no mip map)

virtual void makVrv::DtOsgTexturizer::project1dTexture ( osg::Node *  node,
const std::string &  texdef,
const osg::Matrix &  mat,
osg::Texture::WrapMode  wrapmode,
osg::TexEnv::Mode  blendmode,
unsigned int  texunit 
)
protectedvirtual

Project texture texdef onto node using generated coordinates, using texture matrix mat.

virtual void makVrv::DtOsgTexturizer::rescaleTexture ( osg::Node *  node,
const osg::Matrix &  mat,
osg::TexEnv::Mode  blendmode,
unsigned int  texunit 
)
protectedvirtual

rescale texture on node using generated coordinates and texture matrix mat

virtual bool makVrv::DtOsgTexturizer::isNameTextureExempt ( const std::string &  name) const
protectedvirtual

Returns true if name describes something that should not be texturized (trees, etc.)

virtual osg::Image* makVrv::DtOsgTexturizer::convertImageToRGBA ( osg::Image *  img)
protectedvirtual

Converts a RGB image to an RGBA image. Frees image that is passed in.

Member Data Documentation

DtDe& makVrv::DtOsgTexturizer::myDe
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)