Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
gazebo::rendering::MaterialGenerator Class Reference

Caching, on-the-fly material generator. More...

#include <MaterialGenerator.hh>

Inheritance diagram for gazebo::rendering::MaterialGenerator:
Inheritance graph
[legend]

Classes

class  Impl
 Implementation class that takes care of actual generation or lookup of the various constituent parts (template material, fragment shader and vertex shader). More...
 

Public Types

typedef uint32_t Perm
 Bitfield used to signify a material permutations. More...
 

Public Member Functions

virtual ~MaterialGenerator ()
 
const Ogre::MaterialPtr & GetMaterial (Perm permutation)
 

Protected Types

typedef std::map< Perm,
Ogre::MaterialPtr > 
MaterialMap
 
typedef std::map< Perm,
Ogre::GpuProgramPtr > 
ProgramMap
 

Protected Member Functions

 MaterialGenerator ()
 constructor is protected as this base class should never be constructed as-is. More...
 
const Ogre::GpuProgramPtr & GetFragmentShader (Perm _perm)
 
const Ogre::MaterialPtr & GetTemplateMaterial (Perm _perm)
 
const Ogre::GpuProgramPtr & GetVertexShader (Perm _perm)
 

Protected Attributes

ProgramMap fs
 
Perm fsMask
 Mask of permutation bits that influence fragment shader choice. More...
 
Implimpl
 Generator. More...
 
Ogre::String materialBaseName
 Base name of materials generated by this. More...
 
MaterialMap materials
 
Perm matMask
 Mask of permutation bits that influence template material choice. More...
 
std::string schemeName
 
MaterialMap templateMat
 
ProgramMap vs
 
Perm vsMask
 Mask of permutation bits that influence vertex shader choice. More...
 

Detailed Description

Caching, on-the-fly material generator.

This is a class that automatically generates and stores different permutations of a material, and its shaders. It can be used if you have a material that has lots of slightly different variations, like whether to use a specular light, skinning, normal mapping and other options. Writing all these out is a tedious job. Of course it is possible to always use the material with all features, but that might result in large, slow shader programs. This class provides an efficient solution to that.

Member Typedef Documentation

typedef std::map<Perm, Ogre::MaterialPtr> gazebo::rendering::MaterialGenerator::MaterialMap
protected

Bitfield used to signify a material permutations.

typedef std::map<Perm, Ogre::GpuProgramPtr> gazebo::rendering::MaterialGenerator::ProgramMap
protected

Constructor & Destructor Documentation

gazebo::rendering::MaterialGenerator::MaterialGenerator ( )
protected

constructor is protected as this base class should never be constructed as-is.

It is meant to be subclassed so that values can be assigned to the various fields controlling material generator, and most importantly, the mImpl field.

virtual gazebo::rendering::MaterialGenerator::~MaterialGenerator ( )
virtual

Member Function Documentation

const Ogre::GpuProgramPtr& gazebo::rendering::MaterialGenerator::GetFragmentShader ( Perm  _perm)
protected
const Ogre::MaterialPtr& gazebo::rendering::MaterialGenerator::GetMaterial ( Perm  permutation)
const Ogre::MaterialPtr& gazebo::rendering::MaterialGenerator::GetTemplateMaterial ( Perm  _perm)
protected
const Ogre::GpuProgramPtr& gazebo::rendering::MaterialGenerator::GetVertexShader ( Perm  _perm)
protected

Member Data Documentation

ProgramMap gazebo::rendering::MaterialGenerator::fs
protected
Perm gazebo::rendering::MaterialGenerator::fsMask
protected

Mask of permutation bits that influence fragment shader choice.

Impl* gazebo::rendering::MaterialGenerator::impl
protected

Generator.

Ogre::String gazebo::rendering::MaterialGenerator::materialBaseName
protected

Base name of materials generated by this.

MaterialMap gazebo::rendering::MaterialGenerator::materials
protected
Perm gazebo::rendering::MaterialGenerator::matMask
protected

Mask of permutation bits that influence template material choice.

std::string gazebo::rendering::MaterialGenerator::schemeName
protected
MaterialMap gazebo::rendering::MaterialGenerator::templateMat
protected
ProgramMap gazebo::rendering::MaterialGenerator::vs
protected
Perm gazebo::rendering::MaterialGenerator::vsMask
protected

Mask of permutation bits that influence vertex shader choice.


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