KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::Material Class Reference

A class for shader + texture. More...

#include <Material.h>

Public Member Functions

 Material ()
 A constructor.
 
void OnUpdate ()
 A hook into the game loop for updating uniforms and related stuff.
 
void ProcessForSubmission ()
 Process for various things belonging to the material before submitting the VertexArray (or issuing draw call via RenderCommand::DrawIndexed). Includes uploading uniforms to GPU.
 
void AttatchMainCamera (std::shared_ptr< Camera > mCamera)
 Caching the current camera (m_MainCamera)
 
void AddShader (std::shared_ptr< Shader > shader)
 Add to the list of shaders used by this material.
 
void RemoveShader (std::shared_ptr< Shader > shader)
 Remove from the list of shaders.
 
void AddTexture (std::shared_ptr< Texture > texture)
 Add to the list of textures used by this material.
 
void RemoveTexture (std::shared_ptr< Texture > texture)
 Remove from the list of textures.
 
std::shared_ptr< ShaderGetShader (const std::string &shaderName) const
 Getter for shader list.
 
std::shared_ptr< ShaderGetShader (int index)
 Getter for shader by index.
 
std::shared_ptr< TextureGetTexture (int index)
 Getter for texture by index.
 

Detailed Description

A class for shader + texture.

A material is a complete description of the visual properties of a mesh. This includes a specification of the textures that are mapped to its surface and also various higher-level properties, such as which shader programs to use when rendering the mesh, the input parameters to those shaders, and other parameters that control the functionality of the graphics acceleration hardware itself.

Note
Mesh-material pair contains all the information we need to render the object

Constructor & Destructor Documentation

◆ Material()

Karma::Material::Material ( )

A constructor.

Since
Karma 1.0.0

Member Function Documentation

◆ AddShader()

void Karma::Material::AddShader ( std::shared_ptr< Shader > shader)
inline

Add to the list of shaders used by this material.

Since
Karma 1.0.0

◆ AddTexture()

void Karma::Material::AddTexture ( std::shared_ptr< Texture > texture)
inline

Add to the list of textures used by this material.

Since
Karma 1.0.0

◆ AttatchMainCamera()

void Karma::Material::AttatchMainCamera ( std::shared_ptr< Camera > mCamera)

Caching the current camera (m_MainCamera)

Since
Karma 1.0.0

◆ GetShader() [1/2]

std::shared_ptr< Shader > Karma::Material::GetShader ( const std::string & shaderName) const

Getter for shader list.

Since
Karma 1.0.0

◆ GetShader() [2/2]

std::shared_ptr< Shader > Karma::Material::GetShader ( int index)

Getter for shader by index.

Since
Karma 1.0.0

◆ GetTexture()

std::shared_ptr< Texture > Karma::Material::GetTexture ( int index)

Getter for texture by index.

Since
Karma 1.0.0

◆ OnUpdate()

void Karma::Material::OnUpdate ( )

A hook into the game loop for updating uniforms and related stuff.

Since
Karma 1.0.0

◆ ProcessForSubmission()

void Karma::Material::ProcessForSubmission ( )

Process for various things belonging to the material before submitting the VertexArray (or issuing draw call via RenderCommand::DrawIndexed). Includes uploading uniforms to GPU.

See also
VertexArray::UpdateProcessAndSetReadyForSubmission()
Since
Karma 1.0.0

◆ RemoveShader()

void Karma::Material::RemoveShader ( std::shared_ptr< Shader > shader)
inline

Remove from the list of shaders.

Since
Karma 1.0.0

◆ RemoveTexture()

void Karma::Material::RemoveTexture ( std::shared_ptr< Texture > texture)
inline

Remove from the list of textures.

Since
Karma 1.0.0

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