new class in package PMaterial This class is…

new class in package: PMaterial.

This class is an helper that simplify the access to the multiple layers of Ogre’s materials.
There are 3 levels in a material:

  • technique
  • pass
  • texture units

The usual Ogre way to access to modify a pass diffuse is looking like this:

Ogre::MaterialPtr ptr =  Ogre::MaterialManager::getSingleton( ).load( "mat", "group" );
ptr.getTechnique(0)->getPass(0)->setDiffuse( 1,0,0 );

Using PMaterial, it looks like this:

polymorph::PMaterial ptr;
ptr.load( "mat", "group" );
ptr.diffuse( 1,0,0 );

Selection of technique and pass is optional. The image above shows the fog configuration:

pmat.fogMode( Ogre::FOG_EXP );
pmat.fogDensity( 0.1 );
pmat.fogDistance( 10, 30 );
pmat.fogColor( 0.4, 0.4, 0.4 );

All methods are not yet there, do not worry, they will come soon.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.