xoreos
0.0.5
|
#include <shadermaterial.h>
Classes | |
struct | ShaderMaterialVariable |
Public Types | |
enum | { MATERIAL_OPAQUE = 0x0001, MATERIAL_TRANSPARENT = 0x0002, MATERIAL_TRANSPARENT_B = 0x0004, MATERIAL_DECAL = 0x0008, MATERIAL_SPECIAL_BLEND = 0x0010 } |
Private Member Functions | |
void * | genMaterialVar (uint32 index) |
void | delMaterialVar (uint32 index) |
Private Attributes | |
std::vector< ShaderMaterialVariable > | _variableData |
Shader::ShaderObject * | _fragShader |
uint32 | _flags |
Common::UString | _name |
uint32 | _usageCount |
uint32 | _alphaIndex |
Definition at line 34 of file shadermaterial.h.
anonymous enum |
Enumerator | |
---|---|
MATERIAL_OPAQUE | Render hint; material has no transparency. |
MATERIAL_TRANSPARENT | Material definitely has transparency. |
MATERIAL_TRANSPARENT_B | Material definitely has transparency. |
MATERIAL_DECAL | Material is a decal. |
MATERIAL_SPECIAL_BLEND | Different to default blending. Maybe this should be extended one day. |
Definition at line 36 of file shadermaterial.h.
Graphics::Shader::ShaderMaterial::ShaderMaterial | ( | Shader::ShaderObject * | fragShader, |
const Common::UString & | name = "unnamed" |
||
) |
Definition at line 33 of file shadermaterial.cpp.
References _alphaIndex, _variableData, genMaterialVar(), recalcTextureUnits(), Graphics::Shader::ShaderObject::usageCount, and Graphics::Shader::ShaderObject::variablesCombined.
Graphics::Shader::ShaderMaterial::~ShaderMaterial | ( | ) |
Definition at line 49 of file shadermaterial.cpp.
References _variableData, and delMaterialVar().
void Graphics::Shader::ShaderMaterial::bindFade | ( | Shader::ShaderProgram * | program, |
float | fade | ||
) |
Definition at line 230 of file shadermaterial.cpp.
References _alphaIndex, Graphics::Shader::ShaderProgram::fragmentObject, Graphics::Shader::ShaderProgram::fragmentVariableLocations, ShaderMan, and Graphics::Shader::ShaderObject::variablesCombined.
Referenced by Graphics::Render::RenderQueue::render().
void Graphics::Shader::ShaderMaterial::bindGLState | ( | ) |
Definition at line 236 of file shadermaterial.cpp.
References _flags, and MATERIAL_SPECIAL_BLEND.
Referenced by Graphics::Render::RenderQueue::render(), Graphics::Aurora::ABCFont::renderBind(), Graphics::Aurora::TextureFont::renderBind(), and Graphics::Shader::ShaderRenderable::renderImmediate().
void Graphics::Shader::ShaderMaterial::bindProgram | ( | Shader::ShaderProgram * | program | ) |
Definition at line 206 of file shadermaterial.cpp.
References _variableData, Graphics::Shader::ShaderProgram::fragmentObject, Graphics::Shader::ShaderProgram::fragmentVariableLocations, ShaderMan, and Graphics::Shader::ShaderObject::variablesCombined.
Referenced by Graphics::Aurora::ABCFont::renderBind(), Graphics::Aurora::TextureFont::renderBind(), and Graphics::Shader::ShaderRenderable::renderImmediate().
void Graphics::Shader::ShaderMaterial::bindProgram | ( | Shader::ShaderProgram * | program, |
float | fade | ||
) |
Definition at line 220 of file shadermaterial.cpp.
References _alphaIndex, _variableData, Graphics::Shader::ShaderProgram::fragmentObject, Graphics::Shader::ShaderProgram::fragmentVariableLocations, ShaderMan, and Graphics::Shader::ShaderObject::variablesCombined.
void Graphics::Shader::ShaderMaterial::bindProgramNoFade | ( | Shader::ShaderProgram * | program | ) |
Definition at line 212 of file shadermaterial.cpp.
References _alphaIndex, _variableData, Graphics::Shader::ShaderProgram::fragmentObject, Graphics::Shader::ShaderProgram::fragmentVariableLocations, ShaderMan, and Graphics::Shader::ShaderObject::variablesCombined.
Referenced by Graphics::Render::RenderQueue::render().
|
private |
Definition at line 315 of file shadermaterial.cpp.
References _fragShader, _variableData, Graphics::Shader::SHADER_FLOAT, Graphics::Shader::SHADER_INT, Graphics::Shader::SHADER_ISAMPLER1D, Graphics::Shader::SHADER_ISAMPLER1DARRAY, Graphics::Shader::SHADER_ISAMPLER2D, Graphics::Shader::SHADER_ISAMPLER2DARRAY, Graphics::Shader::SHADER_ISAMPLER3D, Graphics::Shader::SHADER_ISAMPLERCUBE, Graphics::Shader::SHADER_IVEC2, Graphics::Shader::SHADER_IVEC3, Graphics::Shader::SHADER_IVEC4, Graphics::Shader::SHADER_MAT2, Graphics::Shader::SHADER_MAT3, Graphics::Shader::SHADER_MAT4, SHADER_MATERIAL_VARIABLE_OWNED, Graphics::Shader::SHADER_SAMPLER1D, Graphics::Shader::SHADER_SAMPLER1DARRAY, Graphics::Shader::SHADER_SAMPLER1DARRAYSHADOW, Graphics::Shader::SHADER_SAMPLER1DSHADOW, Graphics::Shader::SHADER_SAMPLER2D, Graphics::Shader::SHADER_SAMPLER2DARRAY, Graphics::Shader::SHADER_SAMPLER2DARRAYSHADOW, Graphics::Shader::SHADER_SAMPLER2DSHADOW, Graphics::Shader::SHADER_SAMPLER3D, Graphics::Shader::SHADER_SAMPLERBUFFER, Graphics::Shader::SHADER_SAMPLERCUBE, Graphics::Shader::SHADER_UNIFORM_BUFFER, Graphics::Shader::SHADER_USAMPLER1D, Graphics::Shader::SHADER_USAMPLER1DARRAY, Graphics::Shader::SHADER_USAMPLER2D, Graphics::Shader::SHADER_USAMPLER2DARRAY, Graphics::Shader::SHADER_USAMPLER3D, Graphics::Shader::SHADER_USAMPLERCUBE, Graphics::Shader::SHADER_VEC2, Graphics::Shader::SHADER_VEC3, Graphics::Shader::SHADER_VEC4, and Graphics::Shader::ShaderObject::variablesCombined.
Referenced by setVariableExternal(), and ~ShaderMaterial().
|
private |
Definition at line 255 of file shadermaterial.cpp.
References _fragShader, _variableData, Graphics::Shader::SHADER_FLOAT, Graphics::Shader::SHADER_INT, Graphics::Shader::SHADER_ISAMPLER1D, Graphics::Shader::SHADER_ISAMPLER1DARRAY, Graphics::Shader::SHADER_ISAMPLER2D, Graphics::Shader::SHADER_ISAMPLER2DARRAY, Graphics::Shader::SHADER_ISAMPLER3D, Graphics::Shader::SHADER_ISAMPLERCUBE, Graphics::Shader::SHADER_IVEC2, Graphics::Shader::SHADER_IVEC3, Graphics::Shader::SHADER_IVEC4, Graphics::Shader::SHADER_MAT2, Graphics::Shader::SHADER_MAT3, Graphics::Shader::SHADER_MAT4, SHADER_MATERIAL_VARIABLE_OWNED, Graphics::Shader::SHADER_SAMPLER1D, Graphics::Shader::SHADER_SAMPLER1DARRAY, Graphics::Shader::SHADER_SAMPLER1DARRAYSHADOW, Graphics::Shader::SHADER_SAMPLER1DSHADOW, Graphics::Shader::SHADER_SAMPLER2D, Graphics::Shader::SHADER_SAMPLER2DARRAY, Graphics::Shader::SHADER_SAMPLER2DARRAYSHADOW, Graphics::Shader::SHADER_SAMPLER2DSHADOW, Graphics::Shader::SHADER_SAMPLER3D, Graphics::Shader::SHADER_SAMPLERBUFFER, Graphics::Shader::SHADER_SAMPLERCUBE, Graphics::Shader::SHADER_UNIFORM_BUFFER, Graphics::Shader::SHADER_USAMPLER1D, Graphics::Shader::SHADER_USAMPLER1DARRAY, Graphics::Shader::SHADER_USAMPLER2D, Graphics::Shader::SHADER_USAMPLER2DARRAY, Graphics::Shader::SHADER_USAMPLER3D, Graphics::Shader::SHADER_USAMPLERCUBE, Graphics::Shader::SHADER_VEC2, Graphics::Shader::SHADER_VEC3, Graphics::Shader::SHADER_VEC4, and Graphics::Shader::ShaderObject::variablesCombined.
Referenced by setVariableInternal(), and ShaderMaterial().
uint32 Graphics::Shader::ShaderMaterial::getFlags | ( | ) | const |
Definition at line 59 of file shadermaterial.cpp.
References _flags.
Referenced by Graphics::Render::RenderManager::queueRenderable().
Shader::ShaderObject * Graphics::Shader::ShaderMaterial::getFragmentShader | ( | ) | const |
Definition at line 67 of file shadermaterial.cpp.
References _fragShader.
Referenced by Graphics::Shader::ShaderRenderable::updateProgram().
const Common::UString & Graphics::Shader::ShaderMaterial::getName | ( | ) | const |
Definition at line 55 of file shadermaterial.cpp.
References _name.
Referenced by Graphics::Shader::MaterialManager::addMaterial(), Graphics::Shader::MaterialManager::delMaterial(), and Graphics::Shader::MaterialManager::init().
uint32 Graphics::Shader::ShaderMaterial::getVariableCount | ( | ) | const |
Definition at line 71 of file shadermaterial.cpp.
References _fragShader, and Graphics::Shader::ShaderObject::variablesCombined.
void * Graphics::Shader::ShaderMaterial::getVariableData | ( | uint32 | index | ) | const |
Definition at line 80 of file shadermaterial.cpp.
References _variableData.
Referenced by Graphics::Aurora::ABCFont::ABCFont(), Graphics::Aurora::ModelNode_Witcher::buildMaterial(), Graphics::Aurora::ModelNode::buildMaterial(), Graphics::Shader::MaterialManager::init(), and Graphics::Aurora::TextureFont::TextureFont().
void * Graphics::Shader::ShaderMaterial::getVariableData | ( | const Common::UString & | name | ) | const |
Definition at line 84 of file shadermaterial.cpp.
References _fragShader, _variableData, and Graphics::Shader::ShaderObject::variablesCombined.
Definition at line 101 of file shadermaterial.cpp.
References _variableData.
const Common::UString & Graphics::Shader::ShaderMaterial::getVariableName | ( | uint32 | index | ) | const |
Definition at line 97 of file shadermaterial.cpp.
References _fragShader, and Graphics::Shader::ShaderObject::variablesCombined.
Shader::ShaderVariableType Graphics::Shader::ShaderMaterial::getVariableType | ( | uint32 | index | ) | const |
Definition at line 76 of file shadermaterial.cpp.
References _fragShader, and Graphics::Shader::ShaderObject::variablesCombined.
bool Graphics::Shader::ShaderMaterial::isVariableOwned | ( | uint32 | index | ) | const |
Definition at line 190 of file shadermaterial.cpp.
References _variableData, and SHADER_MATERIAL_VARIABLE_OWNED.
bool Graphics::Shader::ShaderMaterial::isVariableOwned | ( | const Common::UString & | name | ) | const |
Definition at line 194 of file shadermaterial.cpp.
References _fragShader, _variableData, SHADER_MATERIAL_VARIABLE_OWNED, and Graphics::Shader::ShaderObject::variablesCombined.
void Graphics::Shader::ShaderMaterial::recalcTextureUnits | ( | ) |
Definition at line 148 of file shadermaterial.cpp.
References _fragShader, _variableData, SHADER_MATERIAL_VARIABLE_OWNED, Graphics::Shader::SHADER_SAMPLER1D, Graphics::Shader::SHADER_SAMPLER2D, Graphics::Shader::SHADER_SAMPLER3D, Graphics::Shader::SHADER_SAMPLERCUBE, and Graphics::Shader::ShaderObject::variablesCombined.
Referenced by setVariableExternal(), setVariableInternal(), and ShaderMaterial().
void Graphics::Shader::ShaderMaterial::restoreGLState | ( | ) |
Definition at line 248 of file shadermaterial.cpp.
void Graphics::Shader::ShaderMaterial::setFlags | ( | uint32 | flags | ) |
Definition at line 63 of file shadermaterial.cpp.
References _flags.
Referenced by Graphics::Aurora::ModelNode_Witcher::buildMaterial(), and Graphics::Aurora::ModelNode::buildMaterial().
void Graphics::Shader::ShaderMaterial::setVariableExternal | ( | uint32 | index, |
void * | loc, | ||
bool | textureUnitRecalc = true |
||
) |
Definition at line 105 of file shadermaterial.cpp.
References _variableData, delMaterialVar(), and recalcTextureUnits().
void Graphics::Shader::ShaderMaterial::setVariableExternal | ( | const Common::UString & | name, |
void * | loc, | ||
bool | textureUnitRecalc = true |
||
) |
Definition at line 113 of file shadermaterial.cpp.
References _fragShader, _variableData, delMaterialVar(), recalcTextureUnits(), and Graphics::Shader::ShaderObject::variablesCombined.
void Graphics::Shader::ShaderMaterial::setVariableInternal | ( | uint32 | index, |
bool | textureUnitRecalc = true |
||
) |
Definition at line 127 of file shadermaterial.cpp.
References genMaterialVar(), and recalcTextureUnits().
void Graphics::Shader::ShaderMaterial::setVariableInternal | ( | const Common::UString & | name, |
bool | textureUnitRecalc = true |
||
) |
Definition at line 135 of file shadermaterial.cpp.
References _fragShader, _variableData, genMaterialVar(), recalcTextureUnits(), and Graphics::Shader::ShaderObject::variablesCombined.
void Graphics::Shader::ShaderMaterial::unbindGLState | ( | ) |
Definition at line 242 of file shadermaterial.cpp.
References _flags, and MATERIAL_SPECIAL_BLEND.
Referenced by Graphics::Render::RenderQueue::render(), Graphics::Shader::ShaderRenderable::renderImmediate(), Graphics::Aurora::ABCFont::renderUnbind(), and Graphics::Aurora::TextureFont::renderUnbind().
uint32 Graphics::Shader::ShaderMaterial::useCount | ( | ) | const |
Definition at line 388 of file shadermaterial.cpp.
References _usageCount.
Referenced by Graphics::Shader::MaterialManager::cleanup().
void Graphics::Shader::ShaderMaterial::useDecrement | ( | ) |
Definition at line 382 of file shadermaterial.cpp.
References _usageCount.
Referenced by Graphics::Shader::ShaderRenderable::setMaterial(), and Graphics::Shader::ShaderRenderable::~ShaderRenderable().
void Graphics::Shader::ShaderMaterial::useIncrement | ( | ) |
Definition at line 378 of file shadermaterial.cpp.
References _usageCount.
Referenced by Graphics::Shader::ShaderRenderable::setMaterial(), and Graphics::Shader::ShaderRenderable::ShaderRenderable().
|
private |
Definition at line 103 of file shadermaterial.h.
Referenced by bindFade(), bindProgram(), bindProgramNoFade(), and ShaderMaterial().
|
private |
Definition at line 98 of file shadermaterial.h.
Referenced by bindGLState(), getFlags(), setFlags(), and unbindGLState().
|
private |
Definition at line 97 of file shadermaterial.h.
Referenced by delMaterialVar(), genMaterialVar(), getFragmentShader(), getVariableCount(), getVariableData(), getVariableName(), getVariableType(), isVariableOwned(), recalcTextureUnits(), setVariableExternal(), and setVariableInternal().
|
private |
Definition at line 100 of file shadermaterial.h.
Referenced by getName().
|
private |
Definition at line 101 of file shadermaterial.h.
Referenced by useCount(), useDecrement(), and useIncrement().
|
private |
Definition at line 96 of file shadermaterial.h.
Referenced by bindProgram(), bindProgramNoFade(), delMaterialVar(), genMaterialVar(), getVariableData(), getVariableFlags(), isVariableOwned(), recalcTextureUnits(), setVariableExternal(), setVariableInternal(), ShaderMaterial(), and ~ShaderMaterial().