NAP
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
BaseMaterial Class Reference

#include <material.h>

Public Member Functions

 BaseMaterial (Core &core)
 
virtual ~BaseMaterial ()=default
 
const BaseShadergetShader () const
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual bool init (utility::ErrorState &errorState)
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 
- Public Member Functions inherited from UniformContainer
 UniformContainer ()=default
 
virtual ~UniformContainer ()=default
 
 UniformContainer (const UniformContainer &)=delete
 
UniformContaineroperator= (const UniformContainer &)=delete
 
UniformStructInstancefindUniform (const std::string &name) const
 
SamplerInstancefindSampler (const std::string &name) const
 
BufferBindingInstancefindBinding (const std::string &name) const
 
ShaderConstantInstancefindConstant (const std::string &name) const
 
const SamplerInstanceListgetSamplers () const
 
const BufferBindingInstanceListgetBufferBindings () const
 
const ShaderConstantInstanceListgetConstants () const
 
const UniformStructInstanceListgetUniformStructs () const
 

Public Attributes

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::vector< ResourcePtr< ShaderConstant > > mConstants
 Property: 'Constants' Static constants (as read from file, or as set in code before calling init()) More...
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Protected Member Functions

bool rebuild (const BaseShader &shader, utility::ErrorState &errorState)
 
- Protected Member Functions inherited from UniformContainer
UniformStructInstancecreateUniformRootStruct (const ShaderVariableStructDeclaration &declaration, const UniformCreatedCallback &uniformCreatedCallback)
 
BufferBindingInstanceaddBindingInstance (std::unique_ptr< BufferBindingInstance > instance)
 
SamplerInstanceaddSamplerInstance (std::unique_ptr< SamplerInstance > instance)
 
ShaderConstantInstanceaddConstantInstance (std::unique_ptr< ShaderConstantInstance > instance)
 

Additional Inherited Members

- Public Types inherited from UniformContainer
using UniformStructInstanceList = std::vector< std::unique_ptr< UniformStructInstance > >
 
using BufferBindingInstanceList = std::vector< std::unique_ptr< BufferBindingInstance > >
 
using SamplerInstanceList = std::vector< std::unique_ptr< SamplerInstance > >
 
using ShaderConstantInstanceList = std::vector< std::unique_ptr< ShaderConstantInstance > >
 
- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Description

Acts as the main interface to any type of shader. 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::MaterialInstanceResource.

Inheritance diagram for BaseMaterial:
[legend]
Collaboration diagram for BaseMaterial:
[legend]

Constructor & Destructor Documentation

◆ BaseMaterial()

BaseMaterial ( Core core)

Base constructor associated with a material

◆ ~BaseMaterial()

virtual ~BaseMaterial ( )
virtualdefault

Member Function Documentation

◆ getShader()

const BaseShader& getShader ( ) const
Returns
The shader

◆ rebuild()

bool rebuild ( const BaseShader shader,
utility::ErrorState errorState 
)
protected

Member Data Documentation

◆ mBuffers

std::vector<ResourcePtr<BufferBinding> > mBuffers

Property: 'Buffers' Static buffer bindings (as read from file, or as set in code before calling init())

◆ mConstants

std::vector<ResourcePtr<ShaderConstant> > mConstants

Property: 'Constants' Static constants (as read from file, or as set in code before calling init())

◆ mSamplers

std::vector<ResourcePtr<Sampler> > mSamplers

Property: 'Samplers' Static samplers (as read from file, or as set in code before calling init())

◆ mUniforms

std::vector<ResourcePtr<UniformStruct> > mUniforms

Property: 'Uniforms' Static uniforms (as read from file, or as set in code before calling init())