Material class
#include <nCine/Graphics/Material.h>
Contains material data for a drawable node.
Describes how a drawable node is rendered: the shader program (one of the predefined types or a custom one), the bound textures, the blending state and the per-draw uniform values. RenderCommand uses this state to configure the GPU pipeline and to build the sort key for a draw call.
Public types
- enum class ShaderProgramType { Sprite = 0, SpriteNoTexture, MeshSprite, MeshSpriteNoTexture, BatchedSprites, BatchedSpritesNoTexture, BatchedMeshSprites, BatchedMeshSpritesNoTexture, Custom }
- One of the predefined shader programs.
Constructors, destructors, conversion operators
Public functions
- auto IsBlendingEnabled() const -> bool
- void SetBlendingEnabled(bool blendingEnabled)
- auto GetSrcBlendingFactor() const -> BlendingFactor
- auto GetDestBlendingFactor() const -> BlendingFactor
- auto GetSrcAlphaBlendingFactor() const -> BlendingFactor
- auto GetDestAlphaBlendingFactor() const -> BlendingFactor
- void SetBlendingFactors(BlendingFactor srcBlendingFactor, BlendingFactor destBlendingFactor)
- Sets the blending factors for both color and alpha.
- void SetBlendingFactors(BlendingFactor srcRgbBlendingFactor, BlendingFactor destRgbBlendingFactor, BlendingFactor srcAlphaBlendingFactor, BlendingFactor destAlphaBlendingFactor)
- Sets separate blending factors for color and alpha (alpha typically
One/OneMinusSrcAlphaso RGBA render targets accumulate correct coverage). - auto GetShaderProgramType() const -> ShaderProgramType
- auto SetShaderProgramType(ShaderProgramType shaderProgramType) -> bool
- auto GetShaderProgram() const -> const RHI::ShaderProgram*
- void SetShaderProgram(RHI::ShaderProgram* program)
- auto SetShader(Shader* shader) -> bool
- void SetDefaultAttributesParameters()
- void ReserveUniformsDataMemory()
-
void SetUniformsDataPointer(std::
uint8_t* dataPointer) - auto HasUniform(const char* name) const -> bool
- Wrapper around
RHI::ShaderUniforms::HasUniform(). - auto HasUniformBlock(const char* name) const -> bool
- Wrapper around
RHI::ShaderUniformBlocks::HasUniformBlock(). - auto Uniform(const char* name) -> RHI::UniformCache*
- Wrapper around
RHI::ShaderUniforms::GetUniform(). - auto UniformBlock(const char* name) -> RHI::UniformBlockCache*
- Wrapper around
RHI::ShaderUniformBlocks::GetUniformBlock(). - auto GetAllUniforms() const -> const RHI::ShaderUniforms::UniformHashMapType&
- Wrapper around
RHI::ShaderUniforms::GetAllUniforms(). - auto GetAllUniformBlocks() const -> const RHI::ShaderUniformBlocks::UniformHashMapType&
- Wrapper around
RHI::ShaderUniformBlocks::GetAllUniformBlocks(). -
auto GetTexture(std::
uint32_t unit) const -> const RHI::Texture* -
auto SetTexture(std::
uint32_t unit, const RHI::Texture* texture) -> bool -
auto SetTexture(std::
uint32_t unit, const Texture& texture) -> bool -
auto SetTexture(std::
uint32_t unit, std:: nullptr_t) -> bool - auto GetTexture() const -> const RHI::Texture*
- auto SetTexture(const RHI::Texture* texture) -> bool
- auto SetTexture(const Texture& texture) -> bool
Constants
- static char InstanceBlockName constexpr
- static char InstancesBlockName constexpr
- static char ModelMatrixUniformName constexpr
- static char GuiProjectionMatrixUniformName constexpr
- static char DepthUniformName constexpr
- static char ProjectionMatrixUniformName constexpr
- static char ViewMatrixUniformName constexpr
- static char ProjectionViewMatrixExcludeString constexpr
- static char TextureUniformName constexpr
- static char ColorUniformName constexpr
- static char SpriteSizeUniformName constexpr
- static char PaletteOffsetUniformName constexpr
- static char TexRectUniformName constexpr
- static char PositionAttributeName constexpr
- static char TexCoordsAttributeName constexpr
- static char MeshIndexAttributeName constexpr
- static char ColorAttributeName constexpr
- static char QuadCornerAttributeName constexpr
- OpenGL|ES 2.0 profile: the static per-vertex quad corner replacing gl_VertexID synthesis.
Enum documentation
enum class nCine:: Material:: ShaderProgramType
One of the predefined shader programs.
| Enumerators | |
|---|---|
| Sprite |
Shader program for |
| SpriteNoTexture |
Shader program for |
| MeshSprite |
Shader program for |
| MeshSpriteNoTexture |
Shader program for |
| BatchedSprites |
Shader program for a batch of |
| BatchedSpritesNoTexture |
Shader program for a batch of |
| BatchedMeshSprites |
Shader program for a batch of |
| BatchedMeshSpritesNoTexture |
Shader program for a batch of |
| Custom |
A custom shader program |