Nebula
Loading...
Searching...
No Matches
Materials Namespace Reference

Detailed Description

Material special version of variant.

Classes

struct  MaterialBuffer
 
struct  MaterialConstant
 
struct  MaterialId
 
struct  MaterialInstanceId
 
class  MaterialLoader
 
struct  MaterialTexture
 
struct  MaterialVariant
 
struct  ShaderConfigBatchTexture
 

Typedefs

typedef IndexT BatchIndex
 
typedef Ids::IdAllocator< float, Util::Array< Resources::ResourceId >, Util::FixedArray< CoreGraphics::ResourceTableId >, CoreGraphics::BufferId, Util::FixedArray< Util::FixedArray< CoreGraphics::ResourceTableId > >, Util::FixedArray< Util::Tuple< IndexT, SizeT > >, Util::FixedArray< Util::Array< MaterialTexture > >, Util::FixedArray< Util::Array< MaterialConstant > >, IndexT, const MaterialTemplates::Entry * > MaterialAllocator
 
typedef Ids::IdAllocator< uintMaterialInstanceAllocator
 
using LoaderFunc = void(*)(Ptr<IO::BXmlReader>, Materials::MaterialId, Util::StringAtom)
 

Enumerations

enum  {
  Material_MinLOD , Material_LODTextures , Material_Table , Material_Buffer ,
  Material_InstanceTables , Material_InstanceBuffers , Material_Textures , Material_Constants ,
  Material_BufferOffset , Material_Template
}
 
enum  MaterialInstanceMembers { MaterialInstance_Offsets }
 

Functions

MaterialId CreateMaterial (const MaterialTemplates::Entry *entry)
 Create material.
 
void DestroyMaterial (const MaterialId id)
 Destroy material.
 
void MaterialSetTexture (const MaterialId mat, const ShaderConfigBatchTexture *bind, const Resources::ResourceId tex)
 Set texture.
 
void MaterialSetTexture (const MaterialId mat, uint name, const Resources::ResourceId tex)
 Set texture.
 
void MaterialSetTextureBindless (const MaterialId mat, uint name, const uint handle, const uint offset, const Resources::ResourceId tex)
 Set bindless texture.
 
void MaterialSetConstants (const MaterialId mat, const void *data, const uint size)
 Set all material constants.
 
void MaterialSetConstant (const MaterialId mat, const void *data, const uint size, const uint offset)
 Set a material constant.
 
void MaterialSetBufferBinding (const MaterialId id, IndexT index)
 Set material GPU buffer binding.
 
IndexT MaterialGetBufferBinding (const MaterialId id)
 Get material GPU buffer binding.
 
void MaterialAddLODTexture (const MaterialId mat, const Resources::ResourceId tex)
 Add texture to LOD update.
 
void MaterialSetLowestLod (const MaterialId mat, float lod)
 Update LOD for material.
 
const MaterialTemplates::EntryMaterialGetTemplate (const MaterialId mat)
 Get material shader config.
 
const Materials::BatchIndex MaterialGetBatchIndex (const MaterialId mat, const MaterialTemplates::BatchGroup batch)
 Get batch index from code.
 
uint64_t MaterialGetSortCode (const MaterialId mat)
 Get sort code.
 
void MaterialApply (const MaterialId id, const CoreGraphics::CmdBufferId buf, IndexT index)
 Apply material.
 
MaterialInstanceId CreateMaterialInstance (const MaterialId material)
 Create material instance.
 
void DestroyMaterialInstance (const MaterialInstanceId materialInstance)
 Destroy material instance.
 
CoreGraphics::ConstantBufferOffset MaterialInstanceAllocate (const MaterialInstanceId mat, const BatchIndex batch)
 Allocate instance constants, call per frame when instance constants are needed.
 
void MaterialInstanceApply (const MaterialInstanceId id, const CoreGraphics::CmdBufferId buf, IndexT index, IndexT bufferIndex)
 Apply material instance.
 
SizeT MaterialInstanceBufferSize (const MaterialInstanceId sur, const BatchIndex batch)
 Get material instance buffer size for batch.
 
 __ImplementClass (Materials::MaterialLoader, 'MALO', Resources::ResourceLoader)
 
void LoadTexture (const Ptr< IO::BXmlReader > &reader, CoreGraphics::TextureId def, const char *name, const char *tag, uint &handle, bool &dirtyFlag)
 
void LoadVec4 (const Ptr< IO::BXmlReader > &reader, const char *name, float value[4], const Math::vec4 &def)
 
void LoadVec3 (const Ptr< IO::BXmlReader > &reader, const char *name, float value[3], const Math::vec3 &def)
 
void LoadFloat (const Ptr< IO::BXmlReader > &reader, const char *name, float &value, const float def)
 
void LoadMaterialParameter (Ptr< IO::BXmlReader > reader, Util::StringAtom name, const MaterialTemplates::Entry *entry, const Materials::MaterialId id, bool immediate)
 

Variables

MaterialAllocator materialAllocator
 
MaterialInstanceAllocator materialInstanceAllocator
 
Threading::CriticalSection materialTextureLoadSection
 
 material
 
Util::Dictionary< MaterialTemplates::MaterialProperties, LoaderFuncLoaderMap
 
struct { 
 
   MATERIAL_LIST MaterialInterfaces::MaterialBindings   Materials::bindings 
 
   CoreGraphics::BufferWithStaging   Materials::materialBindingBuffer 
 
   Threading::CriticalSection   Materials::variantAllocatorLock 
 
   Memory::ArenaAllocator< 4096 >   Materials::variantAllocator 
 
   union DirtySet
 
      struct { 
 
         bool   Materials::graphicsDirty: 1 
 
         bool   Materials::computeDirty: 1 
 
      }  
 
      int   Materials::bits 
 
   }   Materials::dirtySet 
 
state 
 

Typedef Documentation

◆ BatchIndex

◆ LoaderFunc

◆ MaterialAllocator

◆ MaterialInstanceAllocator

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
Material_MinLOD 
Material_LODTextures 
Material_Table 
Material_Buffer 
Material_InstanceTables 
Material_InstanceBuffers 
Material_Textures 
Material_Constants 
Material_BufferOffset 
Material_Template 

◆ MaterialInstanceMembers

Enumerator
MaterialInstance_Offsets 

Function Documentation

◆ __ImplementClass()

Materials::__ImplementClass ( Materials::MaterialLoader ,
'MALO' ,
Resources::ResourceLoader  )

◆ CreateMaterial()

MaterialId Materials::CreateMaterial ( const MaterialTemplates::Entry * entry)

Create material.

◆ CreateMaterialInstance()

MaterialInstanceId Materials::CreateMaterialInstance ( const MaterialId material)

Create material instance.

◆ DestroyMaterial()

void Materials::DestroyMaterial ( const MaterialId id)

Destroy material.

◆ DestroyMaterialInstance()

void Materials::DestroyMaterialInstance ( const MaterialInstanceId materialInstance)

Destroy material instance.

◆ LoadFloat()

void Materials::LoadFloat ( const Ptr< IO::BXmlReader > & reader,
const char * name,
float & value,
const float def )

◆ LoadMaterialParameter()

void Materials::LoadMaterialParameter ( Ptr< IO::BXmlReader > reader,
Util::StringAtom name,
const MaterialTemplates::Entry * entry,
const Materials::MaterialId id,
bool immediate )

◆ LoadTexture()

void Materials::LoadTexture ( const Ptr< IO::BXmlReader > & reader,
CoreGraphics::TextureId def,
const char * name,
const char * tag,
uint & handle,
bool & dirtyFlag )

◆ LoadVec3()

void Materials::LoadVec3 ( const Ptr< IO::BXmlReader > & reader,
const char * name,
float value[3],
const Math::vec3 & def )

◆ LoadVec4()

void Materials::LoadVec4 ( const Ptr< IO::BXmlReader > & reader,
const char * name,
float value[4],
const Math::vec4 & def )

◆ MaterialAddLODTexture()

void Materials::MaterialAddLODTexture ( const MaterialId mat,
const Resources::ResourceId tex )

Add texture to LOD update.

◆ MaterialApply()

void Materials::MaterialApply ( const MaterialId id,
const CoreGraphics::CmdBufferId buf,
IndexT index )

Apply material.

◆ MaterialGetBatchIndex()

const Materials::BatchIndex Materials::MaterialGetBatchIndex ( const MaterialId mat,
const MaterialTemplates::BatchGroup batch )

Get batch index from code.

◆ MaterialGetBufferBinding()

IndexT Materials::MaterialGetBufferBinding ( const MaterialId id)

Get material GPU buffer binding.

◆ MaterialGetSortCode()

uint64_t Materials::MaterialGetSortCode ( const MaterialId mat)

Get sort code.

◆ MaterialGetTemplate()

const MaterialTemplates::Entry * Materials::MaterialGetTemplate ( const MaterialId mat)

Get material shader config.

◆ MaterialInstanceAllocate()

CoreGraphics::ConstantBufferOffset Materials::MaterialInstanceAllocate ( const MaterialInstanceId mat,
const BatchIndex batch )

Allocate instance constants, call per frame when instance constants are needed.

◆ MaterialInstanceApply()

void Materials::MaterialInstanceApply ( const MaterialInstanceId id,
const CoreGraphics::CmdBufferId buf,
IndexT index,
IndexT bufferIndex )

Apply material instance.

◆ MaterialInstanceBufferSize()

SizeT Materials::MaterialInstanceBufferSize ( const MaterialInstanceId mat,
const BatchIndex batch )

Get material instance buffer size for batch.

◆ MaterialSetBufferBinding()

void Materials::MaterialSetBufferBinding ( const MaterialId id,
IndexT index )

Set material GPU buffer binding.

◆ MaterialSetConstant()

void Materials::MaterialSetConstant ( const MaterialId mat,
const void * data,
const uint size,
const uint offset )

Set a material constant.

◆ MaterialSetConstants()

void Materials::MaterialSetConstants ( const MaterialId mat,
const void * data,
const uint size )

Set all material constants.

◆ MaterialSetLowestLod()

void Materials::MaterialSetLowestLod ( const MaterialId mat,
float lod )

Update LOD for material.

◆ MaterialSetTexture() [1/2]

void Materials::MaterialSetTexture ( const MaterialId mat,
const ShaderConfigBatchTexture * bind,
const Resources::ResourceId tex )

Set texture.

◆ MaterialSetTexture() [2/2]

void Materials::MaterialSetTexture ( const MaterialId mat,
uint name,
const Resources::ResourceId tex )

Set texture.

◆ MaterialSetTextureBindless()

void Materials::MaterialSetTextureBindless ( const MaterialId mat,
uint name,
const uint handle,
const uint offset,
const Resources::ResourceId tex )

Set bindless texture.

Variable Documentation

◆ bindings

MATERIAL_LIST MaterialInterfaces::MaterialBindings Materials::bindings

◆ bits

int Materials::bits

◆ computeDirty

bool Materials::computeDirty

◆ [union]

union { ... } ::DirtySet Materials::dirtySet

◆ graphicsDirty

bool Materials::graphicsDirty

◆ LoaderMap

Util::Dictionary<MaterialTemplates::MaterialProperties, LoaderFunc> Materials::LoaderMap

◆ material

Materials::material

◆ materialAllocator

MaterialAllocator Materials::materialAllocator

◆ materialBindingBuffer

CoreGraphics::BufferWithStaging Materials::materialBindingBuffer

◆ materialInstanceAllocator

MaterialInstanceAllocator Materials::materialInstanceAllocator

◆ materialTextureLoadSection

Threading::CriticalSection Materials::materialTextureLoadSection

◆ [struct]

struct { ... } Materials::state

◆ variantAllocator

Memory::ArenaAllocator<4096> Materials::variantAllocator

◆ variantAllocatorLock

Threading::CriticalSection Materials::variantAllocatorLock