![]() |
Polymorph package
|
#include <PMaterial.h>
Public Member Functions | |
PMaterial () | |
PMaterial (const PMaterial &src, std::string name="") | |
virtual | ~PMaterial () |
bool | create (const std::string &groupname, const std::string &materialname) |
bool | load (const std::string &groupname, const std::string &materialname) |
bool | load (Ogre::MaterialPtr ptr) |
void | diffuse (Ogre::Real r, Ogre::Real g, Ogre::Real b, Ogre::Real a=1, ushort technique=0, ushort pass=0) |
void | diffuse (const Ogre::ColourValue &colour, ushort technique=0, ushort pass=0) |
void | specular (Ogre::Real r, Ogre::Real g, Ogre::Real b, Ogre::Real a=1, ushort technique=0, ushort pass=0) |
void | specular (const Ogre::ColourValue &colour, ushort technique=0, ushort pass=0) |
void | ambient (Ogre::Real r, Ogre::Real g, Ogre::Real b, ushort technique=0, ushort pass=0) |
void | ambient (const Ogre::ColourValue &colour, ushort technique=0, ushort pass=0) |
void | emissive (Ogre::Real r, Ogre::Real g, Ogre::Real b, ushort technique=0, ushort pass=0) |
void | emissive (const Ogre::ColourValue &colour, ushort technique=0, ushort pass=0) |
void | fogColor (Ogre::Real r, Ogre::Real g, Ogre::Real b, ushort technique=0, ushort pass=0) |
void | fogColor (const Ogre::ColourValue &colour, ushort technique=0, ushort pass=0) |
void | fogMode (const Ogre::FogMode &mode, ushort technique=0, ushort pass=0) |
void | fogDistance (const Ogre::Real &start, const Ogre::Real &end, ushort technique=0, ushort pass=0) |
void | fogDensity (const Ogre::Real &density, ushort technique=0, ushort pass=0) |
void | fog (bool overwrite, const Ogre::FogMode &mode, const Ogre::ColourValue &colour, const Ogre::Real &density, const Ogre::Real &start, const Ogre::Real &end, ushort technique=0, ushort pass=0) |
bool | addTexture (std::string groupname="", std::string imagename="", ushort technique=0, ushort pass=0) |
bool | addTexture (const Ogre::TexturePtr &ptr, ushort technique=0, ushort pass=0) |
bool | setTexture (std::string groupname, std::string imagename, ushort technique=0, ushort pass=0, ushort textureunit=0) |
bool | setTexture (const Ogre::TexturePtr &ptr, ushort technique=0, ushort pass=0, ushort textureunit=0) |
bool | exists (ushort technique) |
bool | exists (ushort technique, ushort pass) |
bool | exists (ushort technique, ushort pass, ushort texunit) |
Ogre::MaterialPtr & | getMaterial () |
const std::string & | getGroup () |
const std::string & | getName () |
Ogre::Technique * | getTechnique (ushort technique) |
Ogre::Pass * | getPass (ushort technique, ushort pass) |
Ogre::TextureUnitState * | getTextureUnit (ushort technique, ushort pass, ushort textureunit) |
uint | getTextureUnitCount (ushort technique=0, ushort pass=0) |
void | print (bool full=false) |
Private Attributes | |
Ogre::MaterialPtr | _mat |
std::string | _group |
std::string | _name |
Definition at line 60 of file PMaterial.h.
PMaterial::PMaterial | ( | ) |
default constructor of PMaterial all private params stays at default values, no material pointer set by default
Definition at line 56 of file PMaterial.cpp.
PMaterial::PMaterial | ( | const PMaterial & | src, |
std::string | name = "" |
||
) |
clone an existing PMaterial, if source is correctly set otherwise, equivalent to PMaterial()
PMaterial | : object to clone |
std::string,name | of the new material |
Definition at line 59 of file PMaterial.cpp.
References _group, _mat, _name, and polymorph::PUtil::materialLoaded().
|
virtual |
destructor
Definition at line 98 of file PMaterial.cpp.
bool PMaterial::addTexture | ( | std::string | groupname = "" , |
std::string | imagename = "" , |
||
ushort | technique = 0 , |
||
ushort | pass = 0 |
||
) |
shortcut to add a texture unit and load a texture in it
std::string,name | of the resource group, empty by default |
std::string,name | of the new material, empty by default |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 363 of file PMaterial.cpp.
References _mat, exists(), getPass(), and polymorph::PUtil::getTexture().
Referenced by fogColor().
bool PMaterial::addTexture | ( | const Ogre::TexturePtr & | ptr, |
ushort | technique = 0 , |
||
ushort | pass = 0 |
||
) |
shortcut to add a texture unit and load a texture pointer in it
Ogre::TexturePtr | : pointer to texture |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 382 of file PMaterial.cpp.
References _mat, exists(), and getPass().
|
inline |
shortcut to set ambient color
Ogre::Real | : red channel, in range [0,1] |
Ogre::Real | : green channel, in range [0,1] |
Ogre::Real | : blue channel, in range [0,1] |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 194 of file PMaterial.h.
void PMaterial::ambient | ( | const Ogre::ColourValue & | colour, |
ushort | technique = 0 , |
||
ushort | pass = 0 |
||
) |
shortcut to set ambient color
Ogre::ColourValue | : color value |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 253 of file PMaterial.cpp.
References _mat, exists(), and getPass().
bool PMaterial::create | ( | const std::string & | groupname, |
const std::string & | materialname | ||
) |
creation of a new Ogre::Material
std::string,name | of the resource group |
std::string,name | of the nw material |
Definition at line 101 of file PMaterial.cpp.
References _group, _mat, _name, polymorph::PUtil::groupExists(), polymorph::PUtil::materialExists(), and polymorph::PUtil::materialLoaded().
|
inline |
shortcut to set diffuse color
Ogre::Real | : red channel, in range [0,1] |
Ogre::Real | : green channel, in range [0,1] |
Ogre::Real | : blue channel, in range [0,1] |
Ogre::Real | : alpha channel, in range [0,1], 1 by default |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 129 of file PMaterial.h.
void PMaterial::diffuse | ( | const Ogre::ColourValue & | colour, |
ushort | technique = 0 , |
||
ushort | pass = 0 |
||
) |
shortcut to set diffuse color
Ogre::ColourValue | : color value |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 231 of file PMaterial.cpp.
References _mat, exists(), and getPass().
|
inline |
shortcut to set emissive color
Ogre::Real | : red channel, in range [0,1] |
Ogre::Real | : green channel, in range [0,1] |
Ogre::Real | : blue channel, in range [0,1] |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 225 of file PMaterial.h.
void PMaterial::emissive | ( | const Ogre::ColourValue & | colour, |
ushort | technique = 0 , |
||
ushort | pass = 0 |
||
) |
shortcut to set emissive color
Ogre::ColourValue | : color value |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 264 of file PMaterial.cpp.
References _mat, exists(), and getPass().
bool PMaterial::exists | ( | ushort | technique | ) |
test the existence of specified pass in specified technique
ushort | : technique ID |
Definition at line 459 of file PMaterial.cpp.
References _mat.
Referenced by addTexture(), ambient(), diffuse(), emissive(), fog(), fogColor(), fogDensity(), fogDistance(), fogMode(), getTextureUnitCount(), setTexture(), and specular().
bool PMaterial::exists | ( | ushort | technique, |
ushort | pass | ||
) |
test the existence of specified pass in specified technique
ushort | : technique ID |
ushort | : pass ID |
Definition at line 467 of file PMaterial.cpp.
References _mat.
bool PMaterial::exists | ( | ushort | technique, |
ushort | pass, | ||
ushort | texunit | ||
) |
test the existence of specified texture unit in specified technique and specified pass
ushort | : technique ID |
ushort | : pass ID |
ushort | : texture unit ID |
Definition at line 477 of file PMaterial.cpp.
References getTextureUnitCount().
void PMaterial::fog | ( | bool | overwrite, |
const Ogre::FogMode & | mode, | ||
const Ogre::ColourValue & | colour, | ||
const Ogre::Real & | density, | ||
const Ogre::Real & | start, | ||
const Ogre::Real & | end, | ||
ushort | technique = 0 , |
||
ushort | pass = 0 |
||
) |
shortcut to set all fog params at once
bool | : allow material to overwrite scene fog params, false by default |
Ogre::FogMode | : FOG_NONE, FOG_EXP, FOG_EXP2 or FOG_LINEAR, FOG_NONE by default |
Ogre::ColourValue | : color value, white by default |
Ogre::Real | : density, 0.001 by default |
Ogre::Real | : start distance, 0 by default |
Ogre::Real | : end distance, 1 by default |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 347 of file PMaterial.cpp.
References _mat, exists(), and getPass().
Referenced by fogColor().
|
inline |
shortcut to set fog color
Ogre::Real | : red channel, in range [0,1] |
Ogre::Real | : green channel, in range [0,1] |
Ogre::Real | : blue channel, in range [0,1] |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 256 of file PMaterial.h.
References addTexture(), exists(), fog(), fogDensity(), fogDistance(), fogMode(), and setTexture().
void PMaterial::fogColor | ( | const Ogre::ColourValue & | colour, |
ushort | technique = 0 , |
||
ushort | pass = 0 |
||
) |
shortcut to set fog color
Ogre::ColourValue | : color value |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 275 of file PMaterial.cpp.
References _mat, exists(), and getPass().
void PMaterial::fogDensity | ( | const Ogre::Real & | density, |
ushort | technique = 0 , |
||
ushort | pass = 0 |
||
) |
shortcut to set fog density
Ogre::Real | : density |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 329 of file PMaterial.cpp.
References _mat, exists(), and getPass().
Referenced by fogColor().
void PMaterial::fogDistance | ( | const Ogre::Real & | start, |
const Ogre::Real & | end, | ||
ushort | technique = 0 , |
||
ushort | pass = 0 |
||
) |
shortcut to set fog start and end distance
Ogre::Real | : start distance |
Ogre::Real | : end distance |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 311 of file PMaterial.cpp.
References _mat, exists(), and getPass().
Referenced by fogColor().
void PMaterial::fogMode | ( | const Ogre::FogMode & | mode, |
ushort | technique = 0 , |
||
ushort | pass = 0 |
||
) |
shortcut to set fog mode
FOG_NONE,FOG_EXP,FOG_EXP2 | or FOG_LINEAR |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 293 of file PMaterial.cpp.
References _mat, exists(), and getPass().
Referenced by fogColor().
|
inline |
getter for group name
Definition at line 435 of file PMaterial.h.
References _group.
|
inline |
getter for inner Ogre::MaterialPtr
Definition at line 428 of file PMaterial.h.
References _mat.
|
inline |
getter for material name
Definition at line 442 of file PMaterial.h.
References _name.
|
inline |
getter for Ogre::Pass*
ushort | : technique ID |
ushort | : pass ID |
Definition at line 465 of file PMaterial.h.
References _mat, and getTechnique().
Referenced by addTexture(), ambient(), diffuse(), emissive(), fog(), fogColor(), fogDensity(), fogDistance(), fogMode(), getTextureUnit(), getTextureUnitCount(), and specular().
|
inline |
getter for Ogre::Technique*
ushort | : technique ID |
Definition at line 452 of file PMaterial.h.
References _mat.
Referenced by getPass(), and getTextureUnit().
|
inline |
getter for Ogre::TextureUnitState*
ushort | : technique ID |
ushort | : pass ID |
ushort | : texture unit ID |
Definition at line 484 of file PMaterial.h.
References _mat, getPass(), getTechnique(), getTextureUnitCount(), and print().
Referenced by setTexture().
uint PMaterial::getTextureUnitCount | ( | ushort | technique = 0 , |
ushort | pass = 0 |
||
) |
get the number of Ogre::TextureUnitState in a pass
ushort | : technique ID |
ushort | : pass ID |
Definition at line 439 of file PMaterial.cpp.
References _mat, exists(), and getPass().
Referenced by exists(), and getTextureUnit().
bool PMaterial::load | ( | const std::string & | groupname, |
const std::string & | materialname | ||
) |
loading or retrieval of an existing Ogre::Material
std::string,name | of the resource group |
std::string,name | of the new material |
Definition at line 164 of file PMaterial.cpp.
References _group, _mat, _name, and polymorph::PUtil::getMaterial().
bool PMaterial::load | ( | Ogre::MaterialPtr | ptr | ) |
loading of an existing Ogre::Material
Ogre::MaterialPtr,pointer | to the Ogre::Material to store |
Definition at line 190 of file PMaterial.cpp.
void PMaterial::print | ( | bool | full = false | ) |
print material info in console
bool | : set to true for full report: techniques, passes & texture units |
Definition at line 486 of file PMaterial.cpp.
References _group, _mat, _name, and polymorph::PUtil::str().
Referenced by getTextureUnit().
bool PMaterial::setTexture | ( | std::string | groupname, |
std::string | imagename, | ||
ushort | technique = 0 , |
||
ushort | pass = 0 , |
||
ushort | textureunit = 0 |
||
) |
shortcut to load texture in a texture unit
std::string,name | of the resource group |
std::string,name | of the new material |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
ushort | : texture unit ID, 0 by default |
Definition at line 399 of file PMaterial.cpp.
References _mat, exists(), polymorph::PUtil::getTexture(), and getTextureUnit().
Referenced by fogColor().
bool PMaterial::setTexture | ( | const Ogre::TexturePtr & | ptr, |
ushort | technique = 0 , |
||
ushort | pass = 0 , |
||
ushort | textureunit = 0 |
||
) |
shortcut to load texture pointer in a texture unit
Ogre::TexturePtr,texture | pointer |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
ushort | : texture unit ID, 0 by default |
Definition at line 420 of file PMaterial.cpp.
References _mat, exists(), and getTextureUnit().
|
inline |
shortcut to set specular color
Ogre::Real | : red channel, in range [0,1] |
Ogre::Real | : green channel, in range [0,1] |
Ogre::Real | : blue channel, in range [0,1] |
Ogre::Real | : alpha channel, in range [0,1], 1 by default |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 162 of file PMaterial.h.
void PMaterial::specular | ( | const Ogre::ColourValue & | colour, |
ushort | technique = 0 , |
||
ushort | pass = 0 |
||
) |
shortcut to set specular color
Ogre::ColourValue | : color value |
ushort | : technique ID, 0 by default |
ushort | : pass ID, 0 by default |
Definition at line 242 of file PMaterial.cpp.
References _mat, exists(), and getPass().
|
private |
resource group name
Definition at line 519 of file PMaterial.h.
Referenced by create(), getGroup(), load(), PMaterial(), and print().
|
private |
gives access to the Ogre::Material
Definition at line 515 of file PMaterial.h.
Referenced by addTexture(), ambient(), create(), diffuse(), emissive(), exists(), fog(), fogColor(), fogDensity(), fogDistance(), fogMode(), getMaterial(), getPass(), getTechnique(), getTextureUnit(), getTextureUnitCount(), load(), PMaterial(), print(), setTexture(), and specular().
|
private |
material name
Definition at line 523 of file PMaterial.h.
Referenced by create(), getName(), load(), PMaterial(), and print().