![]() |
PURE API 0.5
PR00F's Ultimate Rendering Engine full documentation
|
Material class. More...
Material class.
Definition at line 150 of file PureMaterialManager.h.
#include <PureMaterialManager.h>
Classes | |
class | PureMaterialImpl |
Public Member Functions | |
virtual | ~PureMaterial () |
CConsole & | getManagedConsole () const |
Returns access to console preset with logger module name as this class. | |
TPureBool | allocateArrays (TPureUInt nColorCount, TPureUInt nTexcoordCount, TPureUInt nIndexCount, TPureUInt nIndexSize) |
Allocate color-, texture coordinate-, and index arrays on all available levels. | |
TPureUInt | getIndicesCount () const |
Gets the number of indices. | |
TPureUInt | getColorsCount (TPureUInt level=0) const |
Gets the number of colors on the specified level. | |
TRGBAFLOAT * | getColors (TPureUInt level=0) |
Gets the pointer to colors on the specified level. | |
const TRGBAFLOAT * | getColors (TPureUInt level=0) const |
Gets the pointer to colors on the specified level. | |
TPureUInt | getTexcoordsCount (TPureUInt level=0) const |
Gets the number of texture coordinates on the specified level. | |
TUVW * | getTexcoords (TPureUInt level=0) |
Gets the pointer to texture coordinates on the specified level. | |
const TUVW * | getTexcoords (TPureUInt level=0) const |
Gets the pointer to texture coordinates on the specified level. | |
PureTexture * | getTexture (TPureUInt level=0) |
Gets the texture of the material on the specified level. | |
const PureTexture * | getTexture (TPureUInt level=0) const |
Gets the texture of the material on the specified level. | |
TPureBool | setTexture (PureTexture *tex, TPureUInt level=0) |
Sets the texture of the material on the specified level. | |
TPureUInt | getTextureCount () const |
Gets the number of textures assigned to this material. | |
TPureBool | isTextured () const |
Gets whether the material has at least 1 textured layer. | |
TPureBool | isSingleTextured () const |
Gets whether the material has only 1 textured layer. | |
TPureBool | isMultiTextured () const |
Gets whether the material has at least 2 textured layers. | |
PureColor & | getTextureEnvColor (TPureUInt level=0) |
Gets the texture environment color of the material on the specified level. | |
const PureColor & | getTextureEnvColor (TPureUInt level=0) const |
Gets the texture environment color of the material on the specified level. | |
const TPureBool & | isDecalOffsetEnabled () const |
Gets whether material is used as decal rendering. | |
void | setDecalOffset (TPureBool state) |
Sets decal rendering for this material. | |
TPURE_BLENDFACTOR | getSourceBlendFunc (TPureUInt level=0) const |
Gets the source blend factor on the specified level. | |
TPureBool | setSourceBlendFunc (TPURE_BLENDFACTOR value, TPureUInt level=0) |
Sets the source blend factor on the specified level. | |
TPURE_BLENDFACTOR | getDestinationBlendFunc (TPureUInt level=0) const |
Gets the destination blend factor on the specified level. | |
TPureBool | setDestinationBlendFunc (TPURE_BLENDFACTOR value, TPureUInt level=0) |
Sets the destination blend factor on the specified level. | |
TPureBool | setBlendFuncs (TPURE_BLENDFACTOR src, TPURE_BLENDFACTOR dst, TPureUInt level=0) |
Sets the blend factors on the specified level. | |
TPURE_BLENDMODE | getBlendMode (TPureUInt level=0) const |
Gets the blend mode on the specified level. | |
TPureBool | setBlendMode (TPURE_BLENDMODE mode, TPureUInt level=0) |
Sets the blend mode on the specified level. | |
TPureBool | copyFromMaterial (PureMaterial &srcMat, TPureUInt dstLevel, TPureUInt srcLevel) |
Copies a layer of a material to a layer of this material. | |
virtual TPureUInt | getUsedSystemMemory () const |
Gets the amount of allocated system memory. | |
![]() | |
PureFiledManaged () | |
virtual | ~PureFiledManaged () |
CConsole & | getManagedConsole () const |
Returns access to console preset with logger module name as this class. | |
const std::string & | getFilename () const |
Gets the filename. | |
![]() | |
PureManaged () | |
virtual | ~PureManaged () |
CConsole & | getManagedConsole () const |
Returns access to console preset with logger module name as this class. | |
const PureManaged * | getUtiliser () const |
Returns the managed that utilizes this managed. | |
PureManaged * | getUtiliser () |
Returns the managed that utilizes this managed. | |
void | SetUtiliser (PureManaged *pUtiliser) |
Sets the managed that utilizes this managed. | |
void | DetachFrom () |
Removes the managed from its manager. | |
PureManager * | getManager () const |
Gets the manager of the managed. | |
const std::string & | getName () const |
Gets the name. | |
void | SetName (const std::string &name) |
Sets the name. | |
virtual void | FlushResources () |
This can be used if the specialized managed object has some resources that may be released from memory when not needed anymore. | |
Static Public Member Functions | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
static TPureBool | isBlendFuncReallyBlending (TPURE_BLENDFACTOR sfactor, TPURE_BLENDFACTOR dfactor) |
Gets whether the given source and destination factors really mean blending or not. | |
![]() | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
![]() | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
Protected Member Functions | |
PureMaterial (TPureUInt nLayers=1) | |
Only PureMaterialManager creates it. | |
PureMaterial (const PureMaterial &) | |
PureMaterial & | operator= (const PureMaterial &) |
![]() | |
PureFiledManaged (const PureFiledManaged &other) | |
PureFiledManaged & | operator= (const PureFiledManaged &other) |
void | SetFilename (const std::string &filename) |
Sets the filename. | |
![]() | |
PureManaged (const PureManaged &other) | |
PureManaged & | operator= (const PureManaged &other) |
Private Attributes | |
PureMaterialImpl * | pImpl |
Friends | |
class | PureMaterialManager |
|
virtual |
Definition at line 518 of file PureMaterial.cpp.
|
explicitprotected |
Only PureMaterialManager creates it.
std::bad_alloc | - This class or its ancestor dynamically allocates memory with operator new, in case of failure the exception is not handled but propagated to caller. |
Any | exception that might be thrown by std::vector::push_back(), in case of failure the exception is not handled but propagated to caller. |
Definition at line 983 of file PureMaterial.cpp.
|
protected |
Definition at line 989 of file PureMaterial.cpp.
TPureBool PureMaterial::allocateArrays | ( | TPureUInt | nColorCount, |
TPureUInt | nTexcoordCount, | ||
TPureUInt | nIndexCount, | ||
TPureUInt | nIndexSize ) |
Allocate color-, texture coordinate-, and index arrays on all available levels.
Although the size of color- and texture coordinate arrays may differ, the allocated color index arrays and texture coordinate index arrays will have same size since indexing is done per-vertex.
nColorCount | Size of required color array on each level. |
nTexcoordCount | Size of required texture coordinate array on each level. |
nIndexCount | Size of required index array on each level. |
nIndexSize | Size of an index in Bytes. Should be greater than 0. |
Definition at line 574 of file PureMaterial.cpp.
TPureBool PureMaterial::copyFromMaterial | ( | PureMaterial & | srcMat, |
TPureUInt | dstLevel, | ||
TPureUInt | srcLevel ) |
Copies a layer of a material to a layer of this material.
The array sizes of the 2 materials should match as array layout won't be changed by this method.
srcMat | Material where we are copying a layer from. |
dstLevel | Which layer are we copying from the source material. |
srcLevel | Which layer are we copying to in destination material. |
Definition at line 957 of file PureMaterial.cpp.
TPURE_BLENDMODE PureMaterial::getBlendMode | ( | TPureUInt | level = 0 | ) | const |
Gets the blend mode on the specified level.
0 is the default level.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 925 of file PureMaterial.cpp.
TRGBAFLOAT * PureMaterial::getColors | ( | TPureUInt | level = 0 | ) |
Gets the pointer to colors on the specified level.
0 is the default level.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 606 of file PureMaterial.cpp.
const TRGBAFLOAT * PureMaterial::getColors | ( | TPureUInt | level = 0 | ) | const |
Gets the pointer to colors on the specified level.
0 is the default level.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 620 of file PureMaterial.cpp.
Gets the number of colors on the specified level.
0 is the default level.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 592 of file PureMaterial.cpp.
TPURE_BLENDFACTOR PureMaterial::getDestinationBlendFunc | ( | TPureUInt | level = 0 | ) | const |
Gets the destination blend factor on the specified level.
0 is the default level.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 870 of file PureMaterial.cpp.
TPureUInt PureMaterial::getIndicesCount | ( | ) | const |
Gets the number of indices.
Definition at line 631 of file PureMaterial.cpp.
|
static |
Returns the logger module name of this class.
Intentionally not virtual, so derived class should hide this instead of overriding. Not even private, so user can also access this from outside, for any reason like controlling log filtering per logger module name.
Definition at line 544 of file PureMaterial.cpp.
CConsole & PureMaterial::getManagedConsole | ( | ) | const |
Returns access to console preset with logger module name as this class.
Intentionally not virtual, so the getConsole() in derived class should hide this instead of overriding.
Definition at line 531 of file PureMaterial.cpp.
TPURE_BLENDFACTOR PureMaterial::getSourceBlendFunc | ( | TPureUInt | level = 0 | ) | const |
Gets the source blend factor on the specified level.
0 is the default level.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 840 of file PureMaterial.cpp.
Gets the pointer to texture coordinates on the specified level.
0 is the default level, always used for single-textured materials.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 659 of file PureMaterial.cpp.
Gets the pointer to texture coordinates on the specified level.
0 is the default level, always used for single-textured materials.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 673 of file PureMaterial.cpp.
Gets the number of texture coordinates on the specified level.
0 is the default level, always used for single-textured materials.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 645 of file PureMaterial.cpp.
PureTexture * PureMaterial::getTexture | ( | TPureUInt | level = 0 | ) |
Gets the texture of the material on the specified level.
0 is the default level, always used for single-textured materials.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 687 of file PureMaterial.cpp.
const PureTexture * PureMaterial::getTexture | ( | TPureUInt | level = 0 | ) | const |
Gets the texture of the material on the specified level.
0 is the default level, always used for single-textured materials.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 701 of file PureMaterial.cpp.
TPureUInt PureMaterial::getTextureCount | ( | ) | const |
Gets the number of textures assigned to this material.
Definition at line 726 of file PureMaterial.cpp.
Gets the texture environment color of the material on the specified level.
Texture environment color is used by the texture environment mode / function in producing fragment color and alpha values. The default texture environment color is white [255, 255, 255, 255].
Texture environment mode / function is currently cannot be changed, it is PURE_TEX_FUNC_MODULATE by default, hence even setting texture environment color has no effect at all.
0 is the default level, always used for single-textured materials.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 779 of file PureMaterial.cpp.
Gets the texture environment color of the material on the specified level.
Texture environment color is used by the texture environment mode / function in producing fragment color and alpha values. The default texture environment color is white [255, 255, 255, 255].
Texture environment mode / function is currently cannot be changed, it is PURE_TEX_FUNC_MODULATE by default, hence even setting texture environment color has no effect at all.
0 is the default level, always used for single-textured materials.
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 798 of file PureMaterial.cpp.
|
virtual |
Gets the amount of allocated system memory.
Reimplemented from PureFiledManaged.
Definition at line 968 of file PureMaterial.cpp.
|
static |
Gets whether the given source and destination factors really mean blending or not.
Gets whether the given source and destination blend factors really mean blending or not.
If source factor is PURE_ONE and destination factor is PURE_ZERO, there's no blending even if blending is enabled.
Definition at line 556 of file PureMaterial.cpp.
const TPureBool & PureMaterial::isDecalOffsetEnabled | ( | ) | const |
Gets whether material is used as decal rendering.
See details at setDecalOffset().
Definition at line 810 of file PureMaterial.cpp.
TPureBool PureMaterial::isMultiTextured | ( | ) | const |
Gets whether the material has at least 2 textured layers.
Definition at line 759 of file PureMaterial.cpp.
TPureBool PureMaterial::isSingleTextured | ( | ) | const |
Gets whether the material has only 1 textured layer.
Definition at line 748 of file PureMaterial.cpp.
TPureBool PureMaterial::isTextured | ( | ) | const |
Gets whether the material has at least 1 textured layer.
Definition at line 737 of file PureMaterial.cpp.
|
protected |
Definition at line 995 of file PureMaterial.cpp.
TPureBool PureMaterial::setBlendFuncs | ( | TPURE_BLENDFACTOR | src, |
TPURE_BLENDFACTOR | dst, | ||
TPureUInt | level = 0 ) |
Sets the blend factors on the specified level.
0 is the default level. Equivalent to calling setSourceBlendFunc(src, level) and setDestinationBlendFunc(dst, level), so check their documentation as well for accepted values. See the description of those functions for more details about the cases when there is no effect when calling them.
If you want to utilize transparency of a loaded 32 bit color depth bitmap, you have to make sure the bitmap has proper alpha values. Some image editing applications don't save proper alpha values, as explained at PureImageManager::createFromFile().
For bitmaps not having proper alpha bits use (PURE_SRC_ALPHA, PURE_ONE) for src and dst respectively. For bitmaps having proper alpha bits use (PURE_SRC_ALPHA, PURE_ONE_MINUS_SRC_ALPHA) for src and dst respectively to utilize real alpha.
src | Source blend factor to be set on the specified level. |
dst | Destination blend factor to be set on the specified level. |
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 910 of file PureMaterial.cpp.
TPureBool PureMaterial::setBlendMode | ( | TPURE_BLENDMODE | mode, |
TPureUInt | level = 0 ) |
Sets the blend mode on the specified level.
0 is the default level. PURE_BM_MANUAL input is ignored, it is set by the engine when the blend factors do not match with a predefined blend mode. No effect if the material doesn't have an utiliser entity (e.g. PureObject3D instance) or if the utiliser doesn't have its parent set (e.g. PureObject3DManager).
mode | The requested blend mode. |
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 941 of file PureMaterial.cpp.
void PureMaterial::setDecalOffset | ( | TPureBool | state | ) |
Sets decal rendering for this material.
Useful when you have coplanar overlaying surfaces, to avoid Z-fighting/bleeding: enable this for the decal surface which supposed to be on top of the other surface. If enabled, the calculated depth values of the fragments will be offset enough to make the fragments appear on top of the fragments of the other surface. Basically this controls glPolygonOffset() behind the scene. By default it is disabled.
state | True for enabling decal / polygon offseting, false for disabling it. |
Definition at line 826 of file PureMaterial.cpp.
TPureBool PureMaterial::setDestinationBlendFunc | ( | TPURE_BLENDFACTOR | value, |
TPureUInt | level = 0 ) |
Sets the destination blend factor on the specified level.
0 is the default level. No effect if the given value is one of the following: PURE_DST_COLOR, PURE_ONE_MINUS_DST_COLOR, PURE_SRC_ALPHA_SATURATE. No effect if the material doesn't have an utiliser entity (e.g. PureObject3D instance) or if the utiliser doesn't have its parent set (e.g. PureObject3DManager).
value | Destination blend factor to be set on the specified level. |
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 887 of file PureMaterial.cpp.
TPureBool PureMaterial::setSourceBlendFunc | ( | TPURE_BLENDFACTOR | value, |
TPureUInt | level = 0 ) |
Sets the source blend factor on the specified level.
0 is the default level. No effect if the given value is PURE_SRC_COLOR or PURE_ONE_MINUS_SRC_COLOR. No effect if the material doesn't have an utiliser entity (e.g. PureObject3D instance) or if the utiliser doesn't have its parent set (e.g. PureObject3DManager).
value | Source blend factor to be set on the specified level. |
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 856 of file PureMaterial.cpp.
TPureBool PureMaterial::setTexture | ( | PureTexture * | tex, |
TPureUInt | level = 0 ) |
Sets the texture of the material on the specified level.
0 is the default level, always used for single-textured materials.
tex | Texture we are defining for the specified level. Texture can be unassigned from the specified level by specifying NULL here. |
level | The material level/layer we are interested in. Should be less than MaterialManager::getMaximumLayerCount(). |
Definition at line 715 of file PureMaterial.cpp.
|
friend |
Definition at line 241 of file PureMaterialManager.h.
|
private |
Definition at line 239 of file PureMaterialManager.h.