NDEVR
API Documentation
GLESMaterialManager

Structure responsible for handling the OpenGL data surrounding a particular Material object. More...

Collaboration diagram for GLESMaterialManager:
[legend]

Public Member Functions

 GLESMaterialManager (const DynamicPointer< GLESGraphicsDevice > &device)
 Constructs a GLESMaterialManager for the given device.
 ~GLESMaterialManager ()
 Destroys the material manager and releases GPU resources.
void addMaterial (const Material &material)
 Adds a material to this manager's material list.
void checkImages ()
 Checks whether any image textures need re-uploading.
void cleanup ()
 Releases all GPU resources held by this manager.
void clearMaterials ()
 Removes all materials from this manager.
void commit ()
 Commits pending uniform buffer changes to the GPU.
void createPipeline (GraphicsUpdateArguments &args, DynamicPointer< GLESShaderManager > &shader_manager, DynamicPointer< GLESImageManager > &manager)
 Creates or recreates the rendering pipeline for the current materials.
fltp04 depthBias () const
 Returns the depth bias offset.
fltp04 fadeDistance () const
 Returns the distance at which objects begin to fade.
StringView getColorByChannel (GraphicsUpdateArguments &args) const
 Returns the name of the color-by channel for the current material.
StringView getExtraPropertyChannel () const
 Returns the extra property channel name.
FragUniformObject getFragUniformObject (const Material &material) const
 Builds a fragment uniform object from the given material.
uint04 getNumberOfImages (const GraphicsUpdateArguments &args) const
 Returns the number of active texture images.
GLESShadergetShader (GLESShader::Definition &definition) const
 Returns the shader matching the given definition, creating if needed.
GLESVertexUniformObject getVertexUniformObject (const Material &material) const
 Builds a vertex uniform object from the given material.
bool hasGrid () const
 Checks whether any material uses grid rendering.
bool hasImage () const
 Checks whether any material has a texture image.
bool hasOpacity () const
 Checks whether any material has opacity.
uint08 id () const
 Returns a unique identifier for this material manager instance.
bool ignoreDepth () const
 Checks whether depth testing should be ignored.
bool isTwoSided () const
 Checks whether the material is two-sided.
bool isWireframe () const
 Checks whether the material renders as wireframe.
Time lastDependencyUpdate () const
 Returns the last time material dependencies were pushed to GPU.
UUID material () const
 Returns the UUID of the primary material managed by this instance.
bool overrideCamera () const
 Checks whether the material overrides the camera projection.
void setUniformVariables (GLESShader *shader)
 Pushes uniform values to the given shader.
bool smoothNormals () const
 Checks whether smooth normal interpolation is enabled.
void updateImages (const Material &material, GraphicsUpdateArguments &args, DynamicPointer< GLESImageManager > &manager)
 Updates GPU textures for the given material.
void updateUniformBuffer (GraphicsUpdateArguments &args)
 Updates uniform buffers from the current material state.
bool useLighting () const
 Checks whether lighting is enabled for the material.
bool useNormalForTexture () const
 Checks whether normals are used for texture coordinate generation.
bool usesLayerColor () const
 Checks whether layer color overrides material color.
bool usesModelColor () const
 Checks whether model color overrides material color.
const GLESVertexUniformObjectvertexUniform () const
 Returns the current vertex uniform object.
bool writeToDepth () const
 Checks whether depth writing is enabled.

Static Public Member Functions

static uint08 MaterialID (const Material &material)
 Computes a unique identifier for the given material.

Protected Member Functions

uint04 getLayerNumber (const Material &material) const
 Returns the layer number for the given material.
bool needsToUpdateImage (const Material &material)
 Checks whether the material's image textures need updating.
bool needsToUpdateShader (const Material &material)
 Checks whether the material's shader needs recompilation.
void updateShader (const Material &mat, const GraphicsUpdateArguments &args, DynamicPointer< GLESShaderManager > &shader_manager)
 Updates the shader for the given material if needed.

Detailed Description

Structure responsible for handling the OpenGL data surrounding a particular Material object.


Definition at line 101 of file GLESMaterialManager.h.

Constructor & Destructor Documentation

◆ GLESMaterialManager()

GLESMaterialManager::GLESMaterialManager ( const DynamicPointer< GLESGraphicsDevice > & device)

Constructs a GLESMaterialManager for the given device.

Parameters
[in]deviceThe OpenGL graphics device.

References GLESMaterialManager().

Referenced by GLESMaterialManager().

Member Function Documentation

◆ addMaterial()

void GLESMaterialManager::addMaterial ( const Material & material)

Adds a material to this manager's material list.

Parameters
[in]materialThe material to add.

References material().

◆ createPipeline()

void GLESMaterialManager::createPipeline ( GraphicsUpdateArguments & args,
DynamicPointer< GLESShaderManager > & shader_manager,
DynamicPointer< GLESImageManager > & manager )

Creates or recreates the rendering pipeline for the current materials.

Parameters
[in]argsThe graphics update context.
[in]shader_managerThe shader manager for shader creation.
[in]managerThe image manager for texture loading.

◆ depthBias()

fltp04 GLESMaterialManager::depthBias ( ) const
inline

Returns the depth bias offset.

Returns
The depth bias value.

Definition at line 158 of file GLESMaterialManager.h.

◆ fadeDistance()

fltp04 GLESMaterialManager::fadeDistance ( ) const

Returns the distance at which objects begin to fade.

Returns
The fade distance.

◆ getColorByChannel()

StringView GLESMaterialManager::getColorByChannel ( GraphicsUpdateArguments & args) const

Returns the name of the color-by channel for the current material.

Parameters
[in]argsThe graphics update context.
Returns
A StringView of the channel name.

◆ getExtraPropertyChannel()

StringView GLESMaterialManager::getExtraPropertyChannel ( ) const
inline

Returns the extra property channel name.

Returns
A StringView of the extra channel name.

Definition at line 177 of file GLESMaterialManager.h.

◆ getFragUniformObject()

FragUniformObject GLESMaterialManager::getFragUniformObject ( const Material & material) const

Builds a fragment uniform object from the given material.

Parameters
[in]materialThe material to extract fragment uniforms from.
Returns
The FragUniformObject.

References material().

◆ getLayerNumber()

uint04 GLESMaterialManager::getLayerNumber ( const Material & material) const
protected

Returns the layer number for the given material.

Parameters
[in]materialThe material to query.
Returns
The layer number.

References e_uv_size, and material().

◆ getNumberOfImages()

uint04 GLESMaterialManager::getNumberOfImages ( const GraphicsUpdateArguments & args) const

Returns the number of active texture images.

Parameters
[in]argsThe graphics update context.
Returns
The image count.

◆ getShader()

GLESShader * GLESMaterialManager::getShader ( GLESShader::Definition & definition) const

Returns the shader matching the given definition, creating if needed.

Parameters
[in]definitionThe shader definition to look up.
Returns
A pointer to the matching GLESShader.

◆ getVertexUniformObject()

GLESVertexUniformObject GLESMaterialManager::getVertexUniformObject ( const Material & material) const

Builds a vertex uniform object from the given material.

Parameters
[in]materialThe material to extract vertex uniforms from.
Returns
The GLESVertexUniformObject.

References material().

◆ hasGrid()

bool GLESMaterialManager::hasGrid ( ) const
inline

Checks whether any material uses grid rendering.

Returns
True if grid rendering is active.

Definition at line 115 of file GLESMaterialManager.h.

◆ hasImage()

bool GLESMaterialManager::hasImage ( ) const

Checks whether any material has a texture image.

Returns
True if at least one material has an image.

◆ hasOpacity()

bool GLESMaterialManager::hasOpacity ( ) const
inline

Checks whether any material has opacity.

Returns
True if opacity is active.

Definition at line 140 of file GLESMaterialManager.h.

◆ id()

uint08 GLESMaterialManager::id ( ) const

Returns a unique identifier for this material manager instance.

Returns
The material ID.

◆ ignoreDepth()

bool GLESMaterialManager::ignoreDepth ( ) const
inline

Checks whether depth testing should be ignored.

Returns
True if depth is ignored.

Definition at line 143 of file GLESMaterialManager.h.

◆ isTwoSided()

bool GLESMaterialManager::isTwoSided ( ) const
inline

Checks whether the material is two-sided.

Returns
True if two-sided rendering is active.

Definition at line 200 of file GLESMaterialManager.h.

◆ isWireframe()

bool GLESMaterialManager::isWireframe ( ) const
inline

Checks whether the material renders as wireframe.

Returns
True if wireframe mode is active.

Definition at line 203 of file GLESMaterialManager.h.

◆ lastDependencyUpdate()

Time GLESMaterialManager::lastDependencyUpdate ( ) const
inline

Returns the last time material dependencies were pushed to GPU.

Returns
The last push update time.

Definition at line 194 of file GLESMaterialManager.h.

◆ material()

UUID GLESMaterialManager::material ( ) const

Returns the UUID of the primary material managed by this instance.

Returns
The material UUID.

Referenced by addMaterial(), getFragUniformObject(), getLayerNumber(), getVertexUniformObject(), MaterialID(), needsToUpdateImage(), needsToUpdateShader(), and updateImages().

◆ MaterialID()

uint08 GLESMaterialManager::MaterialID ( const Material & material)
static

Computes a unique identifier for the given material.

Parameters
[in]materialThe material to compute an ID for.
Returns
The material ID.

References material().

◆ needsToUpdateImage()

bool GLESMaterialManager::needsToUpdateImage ( const Material & material)
protected

Checks whether the material's image textures need updating.

Parameters
[in]materialThe material to check.
Returns
True if the image needs to be re-uploaded.

References material().

◆ needsToUpdateShader()

bool GLESMaterialManager::needsToUpdateShader ( const Material & material)
protected

Checks whether the material's shader needs recompilation.

Parameters
[in]materialThe material to check.
Returns
True if the shader needs updating.

References material().

◆ overrideCamera()

bool GLESMaterialManager::overrideCamera ( ) const
inline

Checks whether the material overrides the camera projection.

Returns
True if camera override is active.

Definition at line 206 of file GLESMaterialManager.h.

◆ setUniformVariables()

void GLESMaterialManager::setUniformVariables ( GLESShader * shader)

Pushes uniform values to the given shader.

Parameters
[in]shaderThe shader to update.

◆ smoothNormals()

bool GLESMaterialManager::smoothNormals ( ) const

Checks whether smooth normal interpolation is enabled.

Returns
True if smooth normals are active.

◆ updateImages()

void GLESMaterialManager::updateImages ( const Material & material,
GraphicsUpdateArguments & args,
DynamicPointer< GLESImageManager > & manager )

Updates GPU textures for the given material.

Parameters
[in]materialThe material whose textures need updating.
[in]argsThe graphics update context.
[in]managerThe image manager for texture loading.

References material().

◆ updateShader()

void GLESMaterialManager::updateShader ( const Material & mat,
const GraphicsUpdateArguments & args,
DynamicPointer< GLESShaderManager > & shader_manager )
protected

Updates the shader for the given material if needed.

Parameters
[in]matThe material to update shaders for.
[in]argsThe graphics update context.
[in]shader_managerThe shader manager for shader creation.

◆ updateUniformBuffer()

void GLESMaterialManager::updateUniformBuffer ( GraphicsUpdateArguments & args)

Updates uniform buffers from the current material state.

Parameters
[in]argsThe graphics update context.

◆ useLighting()

bool GLESMaterialManager::useLighting ( ) const

Checks whether lighting is enabled for the material.

Returns
True if lighting is active.

◆ useNormalForTexture()

bool GLESMaterialManager::useNormalForTexture ( ) const
inline

Checks whether normals are used for texture coordinate generation.

Returns
True if normals are used for texture mapping.

Definition at line 209 of file GLESMaterialManager.h.

◆ usesLayerColor()

bool GLESMaterialManager::usesLayerColor ( ) const
inline

Checks whether layer color overrides material color.

Returns
True if layer color is used.

Definition at line 152 of file GLESMaterialManager.h.

◆ usesModelColor()

bool GLESMaterialManager::usesModelColor ( ) const
inline

Checks whether model color overrides material color.

Returns
True if model color is used.

Definition at line 149 of file GLESMaterialManager.h.

◆ vertexUniform()

const GLESVertexUniformObject & GLESMaterialManager::vertexUniform ( ) const
inline

Returns the current vertex uniform object.

Returns
A const reference to the vertex uniform.

Definition at line 124 of file GLESMaterialManager.h.

◆ writeToDepth()

bool GLESMaterialManager::writeToDepth ( ) const
inline

Checks whether depth writing is enabled.

Returns
True if depth writing is active.

Definition at line 146 of file GLESMaterialManager.h.


The documentation for this class was generated from the following file: