Polyphase Game Engine
Loading...
Searching...
No Matches
MaterialBase Class Reference

#include <MaterialBase.h>

Inheritance diagram for MaterialBase:
Material Asset Object

Public Member Functions

 DECLARE_ASSET (MaterialBase, Material)
 
 MaterialBase ()
 
 ~MaterialBase ()
 
virtual void LoadStream (Stream &stream, Platform platform) override
 
virtual void SaveStream (Stream &stream, Platform platform) override
 
virtual void Create () override
 
virtual void Destroy () override
 
virtual bool Import (const std::string &path, ImportOptions *options) override
 
virtual void GatherProperties (std::vector< Property > &outProps) override
 
virtual glm::vec4 GetTypeColor () override
 
virtual const char * GetTypeName () override
 
virtual bool IsBase () const override
 
void Compile ()
 
void MarkStale ()
 
virtual BlendMode GetBlendMode () const override
 
virtual float GetMaskCutoff () const override
 
virtual int32_t GetSortPriority () const override
 
virtual bool IsDepthTestDisabled () const override
 
virtual bool ShouldApplyFog () const override
 
virtual CullMode GetCullMode () const override
 
void SetBlendMode (BlendMode blendMode)
 
void SetMaskCutoff (float cutoff)
 
void SetSortPriority (int32_t priority)
 
void SetDepthTestDisabled (bool depthTest)
 
void SetApplyFog (bool applyFog)
 
void SetCullMode (CullMode cullMode)
 
uint32_t GetNumScalarParameters ()
 
uint32_t GetNumVectorParameters ()
 
uint32_t GetNumTextureParameters ()
 
uint32_t GetUniformBufferSize ()
 
const std::vector< uint8_t > & GetVertexShaderCode (VertexType type) const
 
const std::vector< uint8_t > & GetFragmentShaderCode ()
 
MaterialLiteGetLiteFallback () const
 
- Public Member Functions inherited from Material
 DECLARE_ASSET (Material, Asset)
 
virtual bool ShouldSnapshotForPie () const override
 
MaterialResourceGetResource ()
 
virtual bool IsInstance () const
 
virtual bool IsLite () const
 
MaterialLiteAsLite ()
 
std::vector< ShaderParameter > & GetParameters ()
 
void SetScalarParameter (const std::string &name, float value)
 
void SetVectorParameter (const std::string &name, glm::vec4 value)
 
void SetTextureParameter (const std::string &name, Texture *value)
 
float GetScalarParameter (const std::string &name)
 
glm::vec4 GetVectorParameter (const std::string &name)
 
TextureGetTextureParameter (const std::string &name)
 
void WriteShaderUniformParams (uint8_t *outData, uint32_t &outSize)
 
virtual bool HasNodeGraph () const
 
virtual NodeGraphGetNodeGraph ()
 
virtual void ApplyGraphValues (NodeGraph *graph)
 
- Public Member Functions inherited from Asset
 DECLARE_FACTORY_MANAGER (Asset)
 
 DECLARE_FACTORY (Asset, Asset)
 
 DECLARE_OBJECT (Asset, Object)
 
 Asset ()
 
virtual ~Asset ()
 
virtual void Copy (Asset *srcAsset)
 
const std::string & GetName () const
 
bool IsLoaded () const
 
bool IsRefCounted () const
 
int32_t GetRefCount () const
 
bool IsEmbedded () const
 
void SetEmbedded (bool embed)
 
bool IsEngineAsset () const
 
void SetEngineAsset (bool engineAsset)
 
void SetName (const std::string &name)
 
void IncrementRefCount ()
 
void DecrementRefCount ()
 
void LoadFile (const char *path, AsyncLoadRequest *request=nullptr)
 
void LoadEmbedded (const EmbeddedFile *embeddedAsset, AsyncLoadRequest *request=nullptr)
 
void SaveFile (const char *path, Platform platform)
 
virtual const char * GetTypeImportExt ()
 
bool IsTransient () const
 
void SetTransient (bool transient)
 
uint64_t GetUuid () const
 
void SetUuid (uint64_t uuid)
 
void EnsureUuid ()
 
void WriteHeader (Stream &stream)
 
- Public Member Functions inherited from Object
virtual ~Object ()=default
 
virtual const char * RuntimeName () const =0
 
virtual const char * RuntimeParentName () const =0
 
virtual RuntimeId InstanceRuntimeId () const =0
 
virtual ObjectQueryInterface (RuntimeId id) const
 
virtual bool Is (RuntimeId id) const
 
virtual bool Is (const char *name) const
 
virtual bool DrawCustomProperty (Property &prop)
 
template<typename T >
T * As () const
 
virtual bool Equals (const Object *rhs) const
 

Static Public Member Functions

static bool HandlePropChange (Datum *datum, uint32_t index, const void *newValue)
 
- Static Public Member Functions inherited from Material
static MaterialLiteAsLite (Material *material)
 
static void OverwriteShaderParameters (std::vector< ShaderParameter > &dst, const std::vector< ShaderParameter > &src)
 
- Static Public Member Functions inherited from Asset
static AssetHeader ReadHeader (Stream &stream)
 
static std::string GetNameFromPath (const std::string &path)
 
static std::string GetDirectoryFromPath (const std::string &path)
 
static const char * GetNameFromTypeId (TypeId id)
 
static TypeId GetTypeIdFromName (const char *name)
 
- Static Public Member Functions inherited from Object
static const char * ClassRuntimeName ()
 

Protected Attributes

std::string mShader
 
BlendMode mBlendMode = BlendMode::Opaque
 
float mMaskCutoff = 0.5f
 
int32_t mSortPriority = 0
 
bool mDisableDepthTest = false
 
bool mApplyFog = true
 
CullMode mCullMode = CullMode::Back
 
MaterialRef mLiteFallback
 
std::vector< uint8_t > mVertexCode [(uint32_t) VertexType::Max]
 
std::vector< uint8_t > mFragmentCode
 
uint32_t mNumScalarParams = 0
 
uint32_t mNumVectorParams = 0
 
uint32_t mNumTextureParams = 0
 
bool mCompiled = false
 
bool mCompilationStale = true
 
- Protected Attributes inherited from Material
std::vector< ShaderParametermParameters
 
MaterialResource mResource
 
- Protected Attributes inherited from Asset
uint32_t mVersion = 0
 
TypeId mType = INVALID_TYPE_ID
 
uint64_t mUuid = 0
 
bool mEmbedded = false
 
bool mLoaded = false
 
bool mEnableRefCount = true
 
bool mEngineAsset = false
 
bool mTransient = false
 
std::string mName = "Asset"
 
int32_t mRefCount = 0
 

Constructor & Destructor Documentation

◆ MaterialBase()

MaterialBase::MaterialBase ( )

◆ ~MaterialBase()

MaterialBase::~MaterialBase ( )

Member Function Documentation

◆ Compile()

void MaterialBase::Compile ( )

◆ Create()

void MaterialBase::Create ( )
overridevirtual

Reimplemented from Material.

◆ DECLARE_ASSET()

MaterialBase::DECLARE_ASSET ( MaterialBase  ,
Material   
)

◆ Destroy()

void MaterialBase::Destroy ( )
overridevirtual

Reimplemented from Material.

◆ GatherProperties()

void MaterialBase::GatherProperties ( std::vector< Property > &  outProps)
overridevirtual

Reimplemented from Material.

◆ GetBlendMode()

BlendMode MaterialBase::GetBlendMode ( ) const
overridevirtual

Reimplemented from Material.

◆ GetCullMode()

CullMode MaterialBase::GetCullMode ( ) const
overridevirtual

Reimplemented from Material.

◆ GetFragmentShaderCode()

const std::vector< uint8_t > & MaterialBase::GetFragmentShaderCode ( )

◆ GetLiteFallback()

MaterialLite * MaterialBase::GetLiteFallback ( ) const

◆ GetMaskCutoff()

float MaterialBase::GetMaskCutoff ( ) const
overridevirtual

Reimplemented from Material.

◆ GetNumScalarParameters()

uint32_t MaterialBase::GetNumScalarParameters ( )

◆ GetNumTextureParameters()

uint32_t MaterialBase::GetNumTextureParameters ( )

◆ GetNumVectorParameters()

uint32_t MaterialBase::GetNumVectorParameters ( )

◆ GetSortPriority()

int32_t MaterialBase::GetSortPriority ( ) const
overridevirtual

Reimplemented from Material.

◆ GetTypeColor()

glm::vec4 MaterialBase::GetTypeColor ( )
overridevirtual

Reimplemented from Material.

◆ GetTypeName()

const char * MaterialBase::GetTypeName ( )
overridevirtual

Reimplemented from Material.

◆ GetUniformBufferSize()

uint32_t MaterialBase::GetUniformBufferSize ( )

◆ GetVertexShaderCode()

const std::vector< uint8_t > & MaterialBase::GetVertexShaderCode ( VertexType  type) const

◆ HandlePropChange()

bool MaterialBase::HandlePropChange ( Datum datum,
uint32_t  index,
const void *  newValue 
)
static

◆ Import()

bool MaterialBase::Import ( const std::string &  path,
ImportOptions options 
)
overridevirtual

Reimplemented from Material.

◆ IsBase()

bool MaterialBase::IsBase ( ) const
overridevirtual

Reimplemented from Material.

◆ IsDepthTestDisabled()

bool MaterialBase::IsDepthTestDisabled ( ) const
overridevirtual

Reimplemented from Material.

◆ LoadStream()

void MaterialBase::LoadStream ( Stream stream,
Platform  platform 
)
overridevirtual

Reimplemented from Material.

◆ MarkStale()

void MaterialBase::MarkStale ( )

◆ SaveStream()

void MaterialBase::SaveStream ( Stream stream,
Platform  platform 
)
overridevirtual

Reimplemented from Material.

◆ SetApplyFog()

void MaterialBase::SetApplyFog ( bool  applyFog)

◆ SetBlendMode()

void MaterialBase::SetBlendMode ( BlendMode  blendMode)

◆ SetCullMode()

void MaterialBase::SetCullMode ( CullMode  cullMode)

◆ SetDepthTestDisabled()

void MaterialBase::SetDepthTestDisabled ( bool  depthTest)

◆ SetMaskCutoff()

void MaterialBase::SetMaskCutoff ( float  cutoff)

◆ SetSortPriority()

void MaterialBase::SetSortPriority ( int32_t  priority)

◆ ShouldApplyFog()

bool MaterialBase::ShouldApplyFog ( ) const
overridevirtual

Reimplemented from Material.

Member Data Documentation

◆ mApplyFog

bool MaterialBase::mApplyFog = true
protected

◆ mBlendMode

BlendMode MaterialBase::mBlendMode = BlendMode::Opaque
protected

◆ mCompilationStale

bool MaterialBase::mCompilationStale = true
protected

◆ mCompiled

bool MaterialBase::mCompiled = false
protected

◆ mCullMode

CullMode MaterialBase::mCullMode = CullMode::Back
protected

◆ mDisableDepthTest

bool MaterialBase::mDisableDepthTest = false
protected

◆ mFragmentCode

std::vector<uint8_t> MaterialBase::mFragmentCode
protected

◆ mLiteFallback

MaterialRef MaterialBase::mLiteFallback
protected

◆ mMaskCutoff

float MaterialBase::mMaskCutoff = 0.5f
protected

◆ mNumScalarParams

uint32_t MaterialBase::mNumScalarParams = 0
protected

◆ mNumTextureParams

uint32_t MaterialBase::mNumTextureParams = 0
protected

◆ mNumVectorParams

uint32_t MaterialBase::mNumVectorParams = 0
protected

◆ mShader

std::string MaterialBase::mShader
protected

◆ mSortPriority

int32_t MaterialBase::mSortPriority = 0
protected

◆ mVertexCode

std::vector<uint8_t> MaterialBase::mVertexCode[(uint32_t) VertexType::Max]
protected

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