Overload  1.1
Game engine with editor
Public Member Functions | Public Attributes | List of all members
OvCore::Resources::Material Class Reference

#include <Material.h>

Inheritance diagram for OvCore::Resources::Material:
OvCore::API::ISerializable

Public Member Functions

void SetShader (OvRendering::Resources::Shader *p_shader)
 
void FillUniform ()
 
void Bind (OvRendering::Resources::Texture *p_emptyTexture)
 
void UnBind ()
 
template<typename T >
void Set (const std::string p_key, const T &p_value)
 
template<typename T >
const T & Get (const std::string p_key)
 
OvRendering::Resources::Shader *& GetShader ()
 
bool HasShader () const
 
void SetBlendable (bool p_blendable)
 
void SetBackfaceCulling (bool p_backfaceCulling)
 
void SetFrontfaceCulling (bool p_frontfaceCulling)
 
void SetDepthTest (bool p_depthTest)
 
void SetDepthWriting (bool p_depthWriting)
 
void SetColorWriting (bool p_colorWriting)
 
void SetGPUInstances (int p_instances)
 
bool IsBlendable () const
 
bool HasBackfaceCulling () const
 
bool HasFrontfaceCulling () const
 
bool HasDepthTest () const
 
bool HasDepthWriting () const
 
bool HasColorWriting () const
 
int GetGPUInstances () const
 
uint8_t GenerateStateMask () const
 
std::map< std::string, std::any > & GetUniformsData ()
 
virtual void OnSerialize (tinyxml2::XMLDocument &p_doc, tinyxml2::XMLNode *p_node) override
 
virtual void OnDeserialize (tinyxml2::XMLDocument &p_doc, tinyxml2::XMLNode *p_node) override
 

Public Attributes

const std::string path
 

Detailed Description

A material is a combination of a shader and some settings (Material settings and shader settings)

Member Function Documentation

◆ Bind()

void OvCore::Resources::Material::Bind ( OvRendering::Resources::Texture p_emptyTexture)

Bind the material and send its uniform data to the GPU @parma p_emptyTexture (The texture to use if a texture uniform is nullptr)

◆ FillUniform()

void OvCore::Resources::Material::FillUniform ( )

Fill uniform with default uniform values

◆ GenerateStateMask()

uint8_t OvCore::Resources::Material::GenerateStateMask ( ) const

Generate an OpenGL state mask with the current material settings

◆ Get()

template<typename T >
const T & OvCore::Resources::Material::Get ( const std::string  p_key)
inline

Set a shader uniform value

Parameters
p_key

◆ GetGPUInstances()

int OvCore::Resources::Material::GetGPUInstances ( ) const

Returns the number of instances

◆ GetShader()

OvRendering::Resources::Shader *& OvCore::Resources::Material::GetShader ( )

Returns the attached shader

◆ GetUniformsData()

std::map< std::string, std::any > & OvCore::Resources::Material::GetUniformsData ( )

Returns the uniforms data of the material

◆ HasBackfaceCulling()

bool OvCore::Resources::Material::HasBackfaceCulling ( ) const

Returns true if the material has backface culling

◆ HasColorWriting()

bool OvCore::Resources::Material::HasColorWriting ( ) const

Returns true if the material has color writing

◆ HasDepthTest()

bool OvCore::Resources::Material::HasDepthTest ( ) const

Returns true if the material has depth test

◆ HasDepthWriting()

bool OvCore::Resources::Material::HasDepthWriting ( ) const

Returns true if the material has depth writing

◆ HasFrontfaceCulling()

bool OvCore::Resources::Material::HasFrontfaceCulling ( ) const

Returns true if the material has frontface culling

◆ HasShader()

bool OvCore::Resources::Material::HasShader ( ) const

Returns true if the material has a shader attached

◆ IsBlendable()

bool OvCore::Resources::Material::IsBlendable ( ) const

Returns true if the material is blendable

◆ OnDeserialize()

void OvCore::Resources::Material::OnDeserialize ( tinyxml2::XMLDocument &  p_doc,
tinyxml2::XMLNode *  p_node 
)
overridevirtual

Deserialize the material

Parameters
p_doc
p_node

Implements OvCore::API::ISerializable.

◆ OnSerialize()

void OvCore::Resources::Material::OnSerialize ( tinyxml2::XMLDocument &  p_doc,
tinyxml2::XMLNode *  p_node 
)
overridevirtual

Serialize the material

Parameters
p_doc
p_node

Implements OvCore::API::ISerializable.

◆ Set()

template<typename T >
void OvCore::Resources::Material::Set ( const std::string  p_key,
const T &  p_value 
)
inline

Set a shader uniform value

Parameters
p_key
p_value

◆ SetBackfaceCulling()

void OvCore::Resources::Material::SetBackfaceCulling ( bool  p_backfaceCulling)

Defines if the material has backface culling

Parameters
p_backfaceCulling

◆ SetBlendable()

void OvCore::Resources::Material::SetBlendable ( bool  p_blendable)

Defines if the material is blendable

Parameters
p_blendable

◆ SetColorWriting()

void OvCore::Resources::Material::SetColorWriting ( bool  p_colorWriting)

Defines if the material has color writting

Parameters
p_colorWriting

◆ SetDepthTest()

void OvCore::Resources::Material::SetDepthTest ( bool  p_depthTest)

Defines if the material has depth test

Parameters
p_depthTest

◆ SetDepthWriting()

void OvCore::Resources::Material::SetDepthWriting ( bool  p_depthWriting)

Defines if the material has depth writting

Parameters
p_depthWriting

◆ SetFrontfaceCulling()

void OvCore::Resources::Material::SetFrontfaceCulling ( bool  p_frontfaceCulling)

Defines if the material has frontface culling

Parameters
p_frontfaceCulling

◆ SetGPUInstances()

void OvCore::Resources::Material::SetGPUInstances ( int  p_instances)

Defines the number of instances

Parameters
p_instances

◆ SetShader()

void OvCore::Resources::Material::SetShader ( OvRendering::Resources::Shader p_shader)

Defines the shader to attach to this material instance

Parameters
p_shader@project: Overload
Author
: Overload Tech. @restrictions: This software may not be resold, redistributed or otherwise conveyed to a third party.

◆ UnBind()

void OvCore::Resources::Material::UnBind ( )

Unbind the material

Member Data Documentation

◆ path

const std::string OvCore::Resources::Material::path

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