HatchitGraphics
Public Member Functions | Protected Attributes | List of all members
Hatchit::Graphics::Material Class Reference
Inheritance diagram for Hatchit::Graphics::Material:

Public Member Functions

 Material (Core::Guid ID)
 
bool Initialize (const std::string &file)
 Initialize a Material synchronously with the GPUResourcePool. More...
 
bool InitializeAsync (Core::Handle< Material > handle)
 
bool SetInt (size_t chunk, size_t offset, int data)
 Sets an integer that should be sent to the Material's pipeline when the material is bound. More...
 
bool SetFloat (size_t chunk, size_t offset, float data)
 Sets a float that should be sent to the Material's pipeline when the material is bound. More...
 
bool SetFloat3 (size_t chunk, size_t offset, Math::Vector3 data)
 Sets a Float3/Math::Vector3 that should be sent to the Material's pipeline when the material is bound. More...
 
bool SetFloat4 (size_t chunk, size_t offset, Math::Vector4 data)
 Sets a Float4/Math::Vector4 that should be sent to the Material's pipeline when the material is bound. More...
 
bool SetMatrix4 (size_t chunk, size_t offset, Math::Matrix4 data)
 Sets a Float16/Math::Vector4 that should be sent to the Material's pipeline when the material is bound. More...
 
bool BindTexture (std::string name, TextureHandle texture)
 Binds a texture to the Material with a given name. More...
 
bool UnbindTexture (std::string name, TextureHandle texture)
 Unbinds a texture from the Material with a given name. More...
 
bool Update ()
 Update the Material's GPU-side data. More...
 
const std::vector< Core::Handle< RenderPass > > & GetRenderPasses () const
 Get a reference to this Material's collection of RenderPasses. More...
 
PipelineHandle const GetPipeline () const
 Get a handle to this Material's Pipeline. More...
 
MaterialBase *const GetBase () const
 Get a pointer to the MaterialBase that this wraps. More...
 

Protected Attributes

MaterialBasem_base
 

Member Function Documentation

bool Hatchit::Graphics::Material::BindTexture ( std::string  name,
TextureHandle  texture 
)

Binds a texture to the Material with a given name.

Parameters
nameThe name of the texture point you want to bind to
textureA handle to the texture you want to bind into the material
Returns
A boolean representing whether or not the operation succeeded
MaterialBase *const Hatchit::Graphics::Material::GetBase ( ) const

Get a pointer to the MaterialBase that this wraps.

Returns
A pointer a MaterialBase object that this object wraps
PipelineHandle const Hatchit::Graphics::Material::GetPipeline ( ) const

Get a handle to this Material's Pipeline.

Returns
a PipelineHandle of this Material's Pipeline
const std::vector< RenderPassHandle > & Hatchit::Graphics::Material::GetRenderPasses ( ) const

Get a reference to this Material's collection of RenderPasses.

This collection describes every compatible RenderPass that this Material should be allowed to bind with.

Returns
A reference to a std::vector of RenderPassHandles that this Material is allowed to bind to
bool Hatchit::Graphics::Material::Initialize ( const std::string &  file)

Initialize a Material synchronously with the GPUResourcePool.

If the GPUResourceThread is already in use the texture will be created directly. If the thread is not locked we will feed the thread a request. This will LOCK the main thread until it completes.

Parameters
fileThe file path of the Material json file that we want to load off the disk
Returns
A boolean representing whether or not this operation succeeded
bool Hatchit::Graphics::Material::SetFloat ( size_t  chunk,
size_t  offset,
float  data 
)

Sets a float that should be sent to the Material's pipeline when the material is bound.

Parameters
chunkThe index describing which ShaderVariableChunk this data should be placed in
offsetThe offset describing how far into the chunk the data should be placed
dataThe data to actually insert into the material's shader info
Returns
A boolean representing whether or not this operation succeeded
bool Hatchit::Graphics::Material::SetFloat3 ( size_t  chunk,
size_t  offset,
Math::Vector3  data 
)

Sets a Float3/Math::Vector3 that should be sent to the Material's pipeline when the material is bound.

Parameters
chunkThe index describing which ShaderVariableChunk this data should be placed in
offsetThe offset describing how far into the chunk the data should be placed
dataThe data to actually insert into the material's shader info
Returns
A boolean representing whether or not this operation succeeded
bool Hatchit::Graphics::Material::SetFloat4 ( size_t  chunk,
size_t  offset,
Math::Vector4  data 
)

Sets a Float4/Math::Vector4 that should be sent to the Material's pipeline when the material is bound.

Parameters
chunkThe index describing which ShaderVariableChunk this data should be placed in
offsetThe offset describing how far into the chunk the data should be placed
dataThe data to actually insert into the material's shader info
Returns
A boolean representing whether or not this operation succeeded
bool Hatchit::Graphics::Material::SetInt ( size_t  chunk,
size_t  offset,
int  data 
)

Sets an integer that should be sent to the Material's pipeline when the material is bound.

Parameters
chunkThe index describing which ShaderVariableChunk this data should be placed in
offsetThe offset describing how far into the chunk the data should be placed
dataThe data to actually insert into the material's shader info
Returns
A boolean representing whether or not this operation succeeded
bool Hatchit::Graphics::Material::SetMatrix4 ( size_t  chunk,
size_t  offset,
Math::Matrix4  data 
)

Sets a Float16/Math::Vector4 that should be sent to the Material's pipeline when the material is bound.

Parameters
chunkThe index describing which ShaderVariableChunk this data should be placed in
offsetThe offset describing how far into the chunk the data should be placed
dataThe data to actually insert into the material's shader info
Returns
A boolean representing whether or not this operation succeeded
bool Hatchit::Graphics::Material::UnbindTexture ( std::string  name,
TextureHandle  texture 
)

Unbinds a texture from the Material with a given name.

Parameters
nameThe name of the texture point you want to unbind from
textureA handle to the texture you want to unbind from the material
Returns
A boolean representing whether or not the operation succeeded
bool Hatchit::Graphics::Material::Update ( )

Update the Material's GPU-side data.

Reorganizes and re-maps the Material's data into its GPU-side representation. This usually consists of updating the mapped chunk of GPU-side memory


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