OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Shader::ShaderVisitor Class Reference

Adjusts the given subgraph to render using shaders. More...

#include <shadervisitor.hpp>

Inheritance diagram for Shader::ShaderVisitor:
Collaboration diagram for Shader::ShaderVisitor:

Classes

struct  ShaderRequirements
 

Public Member Functions

 ShaderVisitor (ShaderManager &shaderManager, Resource::ImageManager &imageManager, const std::string &defaultVsTemplate, const std::string &defaultFsTemplate)
 
void setForceShaders (bool force)
 
void setClampLighting (bool clamp)
 Set whether lighting is clamped for visual compatibility with the fixed function pipeline. More...
 
void setForcePerPixelLighting (bool force)
 
void setAllowedToModifyStateSets (bool allowed)
 
void setAutoUseNormalMaps (bool use)
 Automatically use normal maps if a file with suitable name exists (see normal map pattern). More...
 
void setNormalMapPattern (const std::string &pattern)
 
void setNormalHeightMapPattern (const std::string &pattern)
 
void setAutoUseSpecularMaps (bool use)
 
void setSpecularMapPattern (const std::string &pattern)
 
virtual void apply (osg::Node &node)
 
virtual void apply (osg::Drawable &drawable)
 
virtual void apply (osg::Geometry &geometry)
 
void applyStateSet (osg::ref_ptr< osg::StateSet > stateset, osg::Node &node)
 
void pushRequirements ()
 
void popRequirements ()
 

Private Member Functions

void createProgram (const ShaderRequirements &reqs, osg::Node &node)
 

Private Attributes

bool mForceShaders
 
bool mClampLighting
 
bool mForcePerPixelLighting
 
bool mAllowedToModifyStateSets
 
bool mAutoUseNormalMaps
 
std::string mNormalMapPattern
 
std::string mNormalHeightMapPattern
 
bool mAutoUseSpecularMaps
 
std::string mSpecularMapPattern
 
ShaderManagermShaderManager
 
Resource::ImageManagermImageManager
 
std::vector< ShaderRequirementsmRequirements
 
std::string mDefaultVsTemplate
 
std::string mDefaultFsTemplate
 

Detailed Description

Adjusts the given subgraph to render using shaders.

Constructor & Destructor Documentation

Shader::ShaderVisitor::ShaderVisitor ( ShaderManager shaderManager,
Resource::ImageManager imageManager,
const std::string &  defaultVsTemplate,
const std::string &  defaultFsTemplate 
)

Member Function Documentation

void Shader::ShaderVisitor::apply ( osg::Node &  node)
virtual

Here is the call graph for this function:

void Shader::ShaderVisitor::apply ( osg::Drawable &  drawable)
virtual

Here is the call graph for this function:

void Shader::ShaderVisitor::apply ( osg::Geometry &  geometry)
virtual

Here is the call graph for this function:

void Shader::ShaderVisitor::applyStateSet ( osg::ref_ptr< osg::StateSet >  stateset,
osg::Node &  node 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Shader::ShaderVisitor::createProgram ( const ShaderRequirements reqs,
osg::Node &  node 
)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void Shader::ShaderVisitor::popRequirements ( )

Here is the caller graph for this function:

void Shader::ShaderVisitor::pushRequirements ( )

Here is the caller graph for this function:

void Shader::ShaderVisitor::setAllowedToModifyStateSets ( bool  allowed)

Set if we are allowed to modify StateSets encountered in the graph (default true).

If set to false, then instead of modifying, the StateSet will be cloned and this new StateSet will be assigned to the node.
This option is useful when the ShaderVisitor is run on a "live" subgraph that may have already been submitted for rendering.
void Shader::ShaderVisitor::setAutoUseNormalMaps ( bool  use)

Automatically use normal maps if a file with suitable name exists (see normal map pattern).

void Shader::ShaderVisitor::setAutoUseSpecularMaps ( bool  use)
void Shader::ShaderVisitor::setClampLighting ( bool  clamp)

Set whether lighting is clamped for visual compatibility with the fixed function pipeline.

void Shader::ShaderVisitor::setForcePerPixelLighting ( bool  force)

By default, only bump mapped objects use per-pixel lighting. Setting force = true will cause all shaders to use per-pixel lighting, regardless of having a bump map.

void Shader::ShaderVisitor::setForceShaders ( bool  force)

By default, only bump mapped objects will have a shader added to them. Setting force = true will cause all objects to render using shaders, regardless of having a bump map.

Here is the caller graph for this function:

void Shader::ShaderVisitor::setNormalHeightMapPattern ( const std::string &  pattern)
void Shader::ShaderVisitor::setNormalMapPattern ( const std::string &  pattern)
void Shader::ShaderVisitor::setSpecularMapPattern ( const std::string &  pattern)

Member Data Documentation

bool Shader::ShaderVisitor::mAllowedToModifyStateSets
private
bool Shader::ShaderVisitor::mAutoUseNormalMaps
private
bool Shader::ShaderVisitor::mAutoUseSpecularMaps
private
bool Shader::ShaderVisitor::mClampLighting
private
std::string Shader::ShaderVisitor::mDefaultFsTemplate
private
std::string Shader::ShaderVisitor::mDefaultVsTemplate
private
bool Shader::ShaderVisitor::mForcePerPixelLighting
private
bool Shader::ShaderVisitor::mForceShaders
private
Resource::ImageManager& Shader::ShaderVisitor::mImageManager
private
std::string Shader::ShaderVisitor::mNormalHeightMapPattern
private
std::string Shader::ShaderVisitor::mNormalMapPattern
private
std::vector<ShaderRequirements> Shader::ShaderVisitor::mRequirements
private
ShaderManager& Shader::ShaderVisitor::mShaderManager
private
std::string Shader::ShaderVisitor::mSpecularMapPattern
private

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