#include <material.h>
Classes | |
struct | VertexAttributeBinding |
Public Member Functions | |
Material (Core &core) | |
virtual bool | init (utility::ErrorState &errorState) override |
const Shader & | getShader () const |
EBlendMode | getBlendMode () const |
void | setBlendMode (EBlendMode blendMode) |
EDepthMode | getDepthMode () const |
void | setDepthMode (EDepthMode depthMode) |
const VertexAttributeBinding * | findVertexAttributeBinding (const std::string &shaderAttributeID) const |
![]() | |
BaseMaterial (Core &core) | |
virtual | ~BaseMaterial ()=default |
const BaseShader & | getShader () |
![]() | |
Resource () | |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
![]() | |
UniformContainer ()=default | |
virtual | ~UniformContainer ()=default |
UniformContainer (const UniformContainer &)=delete | |
UniformContainer & | operator= (const UniformContainer &)=delete |
UniformStructInstance * | findUniform (const std::string &name) |
BufferBindingInstance * | findBinding (const std::string &name) |
UniformStructInstance & | getUniform (const std::string &name) |
BufferBindingInstance & | getBinding (const std::string &name) |
const SamplerInstanceList & | getSamplers () const |
const BufferBindingInstanceList & | getBufferBindings () const |
const UniformStructInstanceList & | getUniformStructs () const |
SamplerInstance * | findSampler (const std::string &name) const |
Static Public Member Functions | |
static const std::vector< VertexAttributeBinding > & | sGetDefaultVertexAttributeBindings () |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
Public Attributes | |
std::vector< VertexAttributeBinding > | mVertexAttributeBindings |
Property: 'VertexAttributeBindings' Optional, mapping from mesh vertex attr to shader vertex attr. More... | |
ResourcePtr< Shader > | mShader = nullptr |
Property: 'Shader' The shader that this material is using. More... | |
EBlendMode | mBlendMode = EBlendMode::Opaque |
Property: 'BlendMode' Optional, blend mode for this material. More... | |
EDepthMode | mDepthMode = EDepthMode::InheritFromBlendMode |
Property: 'DepthMode' Optional, determines how the Z buffer is used. More... | |
![]() | |
std::vector< ResourcePtr< UniformStruct > > | mUniforms |
Property: 'Uniforms' Static uniforms (as read from file, or as set in code before calling init()) More... | |
std::vector< ResourcePtr< BufferBinding > > | mBuffers |
Property: 'Buffers' Static buffer bindings (as read from file, or as set in code before calling init()) More... | |
std::vector< ResourcePtr< Sampler > > | mSamplers |
Property: 'Samplers' Static samplers (as read from file, or as set in code before calling init()) More... | |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Additional Inherited Members | |
![]() | |
using | UniformStructInstanceList = std::vector< std::unique_ptr< UniformStructInstance > > |
using | BufferBindingInstanceList = std::vector< std::unique_ptr< BufferBindingInstance > > |
using | SamplerInstanceList = std::vector< std::unique_ptr< SamplerInstance > > |
![]() | |
bool | rebuild (const BaseShader &shader, utility::ErrorState &errorState) |
![]() | |
UniformStructInstance & | createUniformRootStruct (const ShaderVariableStructDeclaration &declaration, const UniformCreatedCallback &uniformCreatedCallback) |
BufferBindingInstance & | addBindingInstance (std::unique_ptr< BufferBindingInstance > instance) |
SamplerInstance & | addSamplerInstance (std::unique_ptr< SamplerInstance > instance) |
Resource that acts as the main interface to a vertex or fragment shader. Controls how vertex buffers are bound to shader inputs.
Note that there is no implicit synchronization of access to shader resources bound to buffer bindings and regular uniforms between render passes. Therefore, it is currently not recommended to write to storage buffers inside vertex and/or fragment shaders over consecutive render passes within a single frame.
const VertexAttributeBinding* findVertexAttributeBinding | ( | const std::string & | shaderAttributeID | ) | const |
Finds the mesh / shader attribute binding based on the given shader attribute ID.
shaderAttributeID | ID of the shader vertex attribute. |
EBlendMode getBlendMode | ( | ) | const |
Returns the current blend mode. Shared by all objects rendered with this material, unless overridden in a nap::MaterialInstance.
EDepthMode getDepthMode | ( | ) | const |
Returns the current depth mode. Shared by all objects rendered with this material, unless overridden in a nap::MaterialInstance.
const Shader& getShader | ( | ) | const |
|
overridevirtual |
Initializes the material. Validates and converts all the declared shader variables into instances and sets up the vertex buffer bindings.
errorState | contains the error if initialization fails. |
Reimplemented from Object.
void setBlendMode | ( | EBlendMode | blendMode | ) |
Sets the blend mode to use. Shared by all objects rendered with this material, unless overridden in a nap::MaterialInstance.
blendMode | new blend mode to use |
void setDepthMode | ( | EDepthMode | depthMode | ) |
Sets the depth mode to use. Shared by all objects rendered with this material, unless overridden in a nap::MaterialInstance.
depthMode | new depth mode to use. |
|
static |
EBlendMode mBlendMode = EBlendMode::Opaque |
Property: 'BlendMode' Optional, blend mode for this material.
EDepthMode mDepthMode = EDepthMode::InheritFromBlendMode |
Property: 'DepthMode' Optional, determines how the Z buffer is used.
ResourcePtr<Shader> mShader = nullptr |
Property: 'Shader' The shader that this material is using.
std::vector<VertexAttributeBinding> mVertexAttributeBindings |
Property: 'VertexAttributeBindings' Optional, mapping from mesh vertex attr to shader vertex attr.