#include <material.h>
Public Member Functions | |
ComputeMaterial (Core &core) | |
virtual bool | init (utility::ErrorState &errorState) override |
const ComputeShader & | getShader () 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 |
Public Attributes | |
ResourcePtr< ComputeShader > | mShader = nullptr |
Property: 'Shader' The compute shader that this material is using. 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 > > |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
![]() | |
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 compute shader. Controls how GPU buffers are bound to shader inputs. It also creates and holds a set of uniform struct instances, matching those exposed by the shader. If a uniform exposed by this material is updated, all the objects rendered using this material will use that same value, unless overridden by a nap::ComputeMaterialInstance.
Unlike nap::Material, does not expose vertex attribute buffer bindings (or blend/depth modes). It is still possible to access a nap::VertexBuffer<T> in a compute shader through a nap::BufferBinding. This way, mesh data can remain static on the GPU, while being mutable in a compute shader.
ComputeMaterial | ( | Core & | core | ) |
core | the core instance |
const ComputeShader& getShader | ( | ) | const |
|
overridevirtual |
Initializes the compute 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.
ResourcePtr<ComputeShader> mShader = nullptr |
Property: 'Shader' The compute shader that this material is using.