sculpto
Classes | Public Member Functions | Static Public Member Functions | List of all members
scl::material_single_color Class Reference

#include <material_single_color.h>

Inheritance diagram for scl::material_single_color:
scl::material

Public Member Functions

const vec3GetColor () const
 
u32 GetIsTexture () const
 
const shared< texture_2d > & GetTexture () const
 
void SetColor (const vec3 &Color)
 
void SetTexture (shared< texture_2d > Texture)
 
 material_single_color ()=default
 
 material_single_color (const material_single_color &MaterialData)=default
 
 material_single_color (const vec3 &Color)
 
 material_single_color (shared< texture_2d > Texture)
 
void Bind () const override
 
void Unbind () const override
 
- Public Member Functions inherited from scl::material
 material (shared< shader_program > Shader)
 
virtual void Bind () const
 
virtual void Unbind () const
 

Static Public Member Functions

static shared< material_single_colorCreate (const vec3 &Color)
 
static shared< material_single_colorCreate (shared< texture_2d > Texture)
 
- Static Public Member Functions inherited from scl::material
static shared< materialCreate (shared< shader_program > Shader)
 

Additional Inherited Members

- Public Attributes inherited from scl::material
shared< shader_programShader {}
 

Detailed Description

Material for blin-phong lighting model class.

Definition at line 19 of file material_single_color.h.

Constructor & Destructor Documentation

◆ material_single_color() [1/4]

scl::material_single_color::material_single_color ( )
default

Default material for blin-phong lighting model constructor.

◆ material_single_color() [2/4]

scl::material_single_color::material_single_color ( const material_single_color MaterialData)
default

Default material data defautl copy constructor.

◆ material_single_color() [3/4]

scl::material_single_color::material_single_color ( const vec3 Color)
inline
  • Material for blin-phong lighting model class contructor.
Parameters
Color- material color.

Definition at line 75 of file material_single_color.h.

75 :
77 {
78 Data.Color = Color;
79 DataBuffer = constant_buffer::Create(&Data, sizeof(buffer_data));
80 }
static shared< constant_buffer > Create(u32 Size)
Definition: buffer.cpp:14
material(shared< shader_program > Shader)
Definition: material.h:27
static shared< shader_program > GetSingleColorMaterialShader()
Definition: render_bridge.h:99

◆ material_single_color() [4/4]

scl::material_single_color::material_single_color ( shared< texture_2d Texture)
inline
  • Material for blin-phong lighting model class contructor.
Parameters
Texture- material texture.

Definition at line 87 of file material_single_color.h.

87 :
89 {
90 this->Texture = Texture;
91 Data.IsTexture = true;
92 DataBuffer = constant_buffer::Create(&Data, sizeof(buffer_data));
93 }

Member Function Documentation

◆ Bind()

void scl::material_single_color::Bind ( ) const
inlineoverridevirtual
  • Bind material to current render stage function.
Parameters
None.
Returns
None.

Reimplemented from scl::material.

Definition at line 101 of file material_single_color.h.

102 {
103 if (Shader) Shader->Bind();
104 if (DataBuffer) DataBuffer->Bind(render_context::BINDING_POINT_MATERIAL_DATA);
105 if (Texture && Data.IsTexture) Texture->Bind(render_context::TEXTURE_SLOT_MATERIAL_DIFFUSE);
106 }
shared< shader_program > Shader
Definition: material.h:20
static const int BINDING_POINT_MATERIAL_DATA
static const int TEXTURE_SLOT_MATERIAL_DIFFUSE

◆ Create() [1/2]

static shared< material_single_color > scl::material_single_color::Create ( const vec3 Color)
inlinestatic
  • Material for blin-phong lighting model class contructor.
Parameters
Color- material color.

Definition at line 126 of file material_single_color.h.

127 {
128 return CreateShared<material_single_color>(Color);
129 }

◆ Create() [2/2]

static shared< material_single_color > scl::material_single_color::Create ( shared< texture_2d Texture)
inlinestatic
  • Material for blin-phong lighting model class contructor.
Parameters
Texture- material texture.

Definition at line 136 of file material_single_color.h.

137 {
138 return CreateShared<material_single_color>(Texture);
139 }

◆ GetColor()

const vec3 & scl::material_single_color::GetColor ( ) const
inline

Material for blin-phong lighing model data getter setter functions.

Material color getter function.

Definition at line 34 of file material_single_color.h.

34{ return Data.Color; }

◆ GetIsTexture()

u32 scl::material_single_color::GetIsTexture ( ) const
inline

Material texture existance flag getter function.

Definition at line 36 of file material_single_color.h.

36{ return Data.IsTexture; }

◆ GetTexture()

const shared< texture_2d > & scl::material_single_color::GetTexture ( ) const
inline

Definition at line 38 of file material_single_color.h.

38{ return Texture; }

◆ SetColor()

void scl::material_single_color::SetColor ( const vec3 Color)
inline

Color setter function.

Definition at line 41 of file material_single_color.h.

41 {
42 if (Texture)
43 {
44 Texture->Free();
45 Texture = nullptr;
46 }
47 Data.IsTexture = false;
48 Data.Color = Color;
49 DataBuffer->Update(&Data, sizeof(Data));
50 }

◆ SetTexture()

void scl::material_single_color::SetTexture ( shared< texture_2d Texture)
inline

Texture setter function.

Definition at line 52 of file material_single_color.h.

52 {
53 if (!Texture) return;
54
55 if (this->Texture) this->Texture->Free();
56 this->Texture = Texture;
57 if (!Data.IsTexture)
58 {
59 Data.IsTexture = true;
60 DataBuffer->Update(&Data, sizeof(Data));
61 }
62 }

◆ Unbind()

void scl::material_single_color::Unbind ( ) const
inlineoverridevirtual
  • Unbind material from current render stage function.
Parameters
None.
Returns
None.

Reimplemented from scl::material.

Definition at line 114 of file material_single_color.h.

115 {
116 if (Shader) Shader->Unbind();
117 if (DataBuffer) DataBuffer->Unbind();
118 if (Texture && Data.IsTexture) Texture->Unbind();
119 }

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