OMK::Vis::MaterialSetShader Class Reference

Action to set shader. More...

#include <OMKEntityMaterialAction.h>

Inheritance diagram for OMK::Vis::MaterialSetShader:

Inheritance graph
[legend]
Collaboration diagram for OMK::Vis::MaterialSetShader:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MaterialSetShader (const std::string &fragment, const std::string &vertex, Ogre::GpuProgramParameters *fragmentPrm, Ogre::GpuProgramParameters *vertexPrm, bool light, const std::string &texture="null")
 The contructor stores the arguments.
virtual ~MaterialSetShader ()
 Destructor.

Private Member Functions

virtual void subEntityAction (SubEntityMaterial *subEntity) const
 The action calls the appropriate function with the arguments.

Private Attributes

Arguments
std::string _fragment
std::string _vertex
Ogre::GpuProgramParameters * _fragmentPrm
Ogre::GpuProgramParameters * _vertexPrm
bool _light
std::string _texture

Detailed Description

Action to set shader.

Allow user to add fragment and shader on a new Pass

Definition at line 149 of file OMKEntityMaterialAction.h.


Constructor & Destructor Documentation

OMK::Vis::MaterialSetShader::MaterialSetShader ( const std::string &  fragment,
const std::string &  vertex,
Ogre::GpuProgramParameters *  fragmentPrm,
Ogre::GpuProgramParameters *  vertexPrm,
bool  light,
const std::string &  texture = "null" 
) [inline]

The contructor stores the arguments.

Definition at line 153 of file OMKEntityMaterialAction.h.

00159   : _fragment( fragment ),
00160     _vertex( vertex ),
00161     _fragmentPrm( fragmentPrm ),
00162     _vertexPrm( vertexPrm ),
00163     _light( light ),
00164     _texture( texture )
00165   {}

virtual OMK::Vis::MaterialSetShader::~MaterialSetShader (  )  [inline, virtual]

Destructor.

Definition at line 167 of file OMKEntityMaterialAction.h.

00167 {}


Member Function Documentation

void MaterialSetShader::subEntityAction ( SubEntityMaterial subEntity  )  const [private, virtual]

The action calls the appropriate function with the arguments.

Reimplemented from OMK::Vis::IMaterialAction.

Definition at line 127 of file OMKEntityMaterialAction.cpp.

References _fragment, _fragmentPrm, _light, _texture, _vertex, _vertexPrm, OMK::Vis::IMaterialAction::getFirstPassOfFirstTechnique(), and OMTRACEID.

00128 {
00129   Pass * pass = getFirstPassOfFirstTechnique( subEntity ) ;
00130 
00131   pass->setLightingEnabled( _light );
00132 
00133   if ( "null" != _texture )
00134   {
00135      pass->createTextureUnitState( _texture ); 
00136      //TextureUnitState *texState = pass->createTextureUnitState( texture ) ; 
00137      //texState->setTextureScroll( 0.f, 0.f ) ;
00138      //texState->setColourOperation( Ogre::LBO_MODULATE ) ;  
00139 
00140      //texState->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);
00141   }  
00142   if ( "null" != _fragment)
00143   { //fragment Program
00144     pass->setFragmentProgram( _fragment );
00145     //copy params passed 
00146     Ogre::GpuProgramParametersSharedPtr fragmentParams = pass->getFragmentProgramParameters() ;
00147     fragmentParams->copyConstantsFrom( *_fragmentPrm ) ;
00148   }
00149   if ( "null" != _vertex)
00150   { //vertex Program
00151     pass->setVertexProgram( _vertex );
00152     //copy params passed 
00153     Ogre::GpuProgramParametersSharedPtr vertexParams = pass->getVertexProgramParameters() ;
00154     vertexParams->copyConstantsFrom( *_vertexPrm ) ;
00155   } 
00156   pass->_load() ;
00157   
00158   OMTRACEID( "DEBUG_MAT", "Shader OK " 
00159           << " fragment " << _fragment 
00160           << " vertex " << _vertex );
00161 }


Member Data Documentation

std::string OMK::Vis::MaterialSetShader::_fragment [private]

Definition at line 171 of file OMKEntityMaterialAction.h.

Referenced by subEntityAction().

std::string OMK::Vis::MaterialSetShader::_vertex [private]

Definition at line 172 of file OMKEntityMaterialAction.h.

Referenced by subEntityAction().

Ogre::GpuProgramParameters* OMK::Vis::MaterialSetShader::_fragmentPrm [private]

Definition at line 173 of file OMKEntityMaterialAction.h.

Referenced by subEntityAction().

Ogre::GpuProgramParameters* OMK::Vis::MaterialSetShader::_vertexPrm [private]

Definition at line 174 of file OMKEntityMaterialAction.h.

Referenced by subEntityAction().

bool OMK::Vis::MaterialSetShader::_light [private]

Definition at line 175 of file OMKEntityMaterialAction.h.

Referenced by subEntityAction().

std::string OMK::Vis::MaterialSetShader::_texture [private]

Definition at line 176 of file OMKEntityMaterialAction.h.

Referenced by subEntityAction().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:05 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007