VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtVreOsgEffectTextureController Class Reference

Detailed Description

DtVreOsgEffectTextureController manages texture swapping effects in the OSG rendering pipeline. Based on VR-Vantage's exampleEffectTexturePlugin, it provides the ability to dynamically apply shader-based effects to textures during rendering. This enables features like map overlays, HUD elements, and other specialized visual effects.

#include <vreOsgEffectTextureController.h>

Inheritance diagram for makVre::DtVreOsgEffectTextureController:
[legend]

Public Member Functions

 DtVreOsgEffectTextureController (makVrv::DtDe &de, int effectTextureType, const std::string &typeString, const std::string &postfix, const std::string &fragFilename, const std::string &vertFilename, const std::string &fragFunction, const std::string &vertFunction, const std::string &effectUnitName, const std::string &indirectTextureMapName, const std::string &indirectTextureCoordName)
 
virtual ~DtVreOsgEffectTextureController () override
 
virtual bool installShaders (int baseUnit, int effectUnit, const osg::Texture *tex, osg::StateSet *stateSet, const std::string &baseTextureName) const override
 

Static Public Member Functions

static osg::ref_ptr< osg::Uniform > getEffectsEnabledUniform ()
 

Private Attributes

std::string myFragShader
 
std::string myVertShader
 
std::string myFragFunction
 
std::string myVertFunction
 
std::string myEffectUnitName
 

Static Private Attributes

static osg::ref_ptr< osg::Uniform > effectsEnabledUniform
 

Constructor & Destructor Documentation

◆ DtVreOsgEffectTextureController()

makVre::DtVreOsgEffectTextureController::DtVreOsgEffectTextureController ( makVrv::DtDe & de,
int effectTextureType,
const std::string & typeString,
const std::string & postfix,
const std::string & fragFilename,
const std::string & vertFilename,
const std::string & fragFunction,
const std::string & vertFunction,
const std::string & effectUnitName,
const std::string & indirectTextureMapName,
const std::string & indirectTextureCoordName )

Constructor.

Parameters
deReference to the display engine
effectTextureTypeType identifier for this effect texture
typeStringString identifier for this effect type
postfixSuffix for shader uniform names
fragFilenameFilename of the fragment shader
vertFilenameFilename of the vertex shader
fragFunctionName of the fragment shader function to call
vertFunctionName of the vertex shader function to call
effectUnitNameName of the texture unit for the effect
indirectTextureMapNameName of the indirect texture map
indirectTextureCoordNameName of the indirect texture coordinates

Creates a new effect texture controller with the specified parameters. These parameters define the shaders, texture units, and naming conventions used by this effect controller.

References de().

◆ ~DtVreOsgEffectTextureController()

virtual makVre::DtVreOsgEffectTextureController::~DtVreOsgEffectTextureController ( )
overridevirtual

Virtual destructor.

Ensures proper cleanup of effect texture controller resources.

Member Function Documentation

◆ installShaders()

virtual bool makVre::DtVreOsgEffectTextureController::installShaders ( int baseUnit,
int effectUnit,
const osg::Texture * tex,
osg::StateSet * stateSet,
const std::string & baseTextureName ) const
overridevirtual

Installs the effect shaders into a state set.

Parameters
baseUnitBase texture unit index
effectUnitEffect texture unit index
texPointer to the effect texture
stateSetState set to install the shaders into
baseTextureNameName of the base texture sampler
Returns
True if shaders were installed successfully, false otherwise

Installs the effect shaders into the provided state set, configuring the necessary uniforms and texture units for the effect. This is called during the rendering process to apply the effect to the specified texture.

◆ getEffectsEnabledUniform()

static osg::ref_ptr< osg::Uniform > makVre::DtVreOsgEffectTextureController::getEffectsEnabledUniform ( )
static

Gets the uniform used for toggling effect textures.

Returns
Reference-counted pointer to the effects enabled uniform

Returns the uniform that controls whether effect textures are enabled. This can be used to globally toggle all effects of this type on or off.

Member Data Documentation

◆ myFragShader

std::string makVre::DtVreOsgEffectTextureController::myFragShader
private

Path to the fragment shader file.

◆ myVertShader

std::string makVre::DtVreOsgEffectTextureController::myVertShader
private

Path to the vertex shader file.

◆ myFragFunction

std::string makVre::DtVreOsgEffectTextureController::myFragFunction
private

Name of the fragment shader function to call.

◆ myVertFunction

std::string makVre::DtVreOsgEffectTextureController::myVertFunction
private

Name of the vertex shader function to call.

◆ myEffectUnitName

std::string makVre::DtVreOsgEffectTextureController::myEffectUnitName
private

Name of the texture unit for the effect.

◆ effectsEnabledUniform

osg::ref_ptr<osg::Uniform> makVre::DtVreOsgEffectTextureController::effectsEnabledUniform
staticprivate

Shared uniform for enabling/disabling all effect textures.


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