sculpto
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
scl::render_context Class Referenceabstract

#include <render_context.h>

Inheritance diagram for scl::render_context:
scl::gl

Public Member Functions

virtual const vec4GetClearColor () const =0
 
virtual bool GetWireframeMode () const =0
 
virtual render_cull_face_mode GetCullingMode () const =0
 
virtual bool GetVSync () const =0
 
virtual void SetClearColor (const vec4 &ClearColor)=0
 
virtual void SetWireframeMode (bool IsWireframe)=0
 
virtual void SetCullingMode (render_cull_face_mode CullingMode)=0
 
virtual void SetVSync (bool VSync)=0
 
 render_context ()
 
virtual ~render_context ()
 
virtual void Init ()=0
 
virtual void Close ()=0
 
virtual void SwapBuffers ()=0
 
virtual void DrawIndices (const shared< vertex_array > &Mesh)=0
 
virtual void DrawIndicesInstanced (const shared< vertex_array > &Mesh, int InstanceCount)=0
 
virtual shared< shader_programGetSingleColorMaterialShader () const =0
 
virtual shared< shader_programGetPhongGeometryShader () const =0
 
virtual shared< shader_programGetPhongLightingShader () const =0
 
virtual shared< shader_programGetShadowPassShader () const =0
 
virtual shared< shader_programGetToneMappingPassShader () const =0
 
virtual shared< shader_programGetGaussianBlurPassShader () const =0
 
virtual shared< shader_programGetTextureAddPassShader () const =0
 

Static Public Member Functions

static render_context_api GetApi ()
 
static u32 GetShaderVariableTypeSize (shader_variable_type Type)
 
static u32 GetShaderVariableComponentsCount (shader_variable_type Type)
 
static unique< render_contextCreate ()
 

Static Public Attributes

static const int BINDING_POINT_SCENE_DATA = 0
 
static const int BINDING_POINT_MATERIAL_DATA = 5
 
static const int BINDING_POINT_LIGHTS_STORAGE = 10
 
static const int BINDING_POINT_SHADOW_CASTERS_STORAGE = 11
 
static const int BINDING_POINT_FREE = 20
 
static const int TEXTURE_SLOT_MATERIAL_DIFFUSE = 0
 
static const int TEXTURE_SLOT_MATERIAL_SPECULAR = 1
 
static const int TEXTURE_SLOT_MATERIAL_EMISSION_MAP = 2
 
static const int TEXTURE_SLOT_MATERIAL_NORMAL_MAP = 3
 
static const int TEXTURE_SLOT_SHADOW_MAP = 5
 
static const int TEXTURE_SLOT_HDR_BUFFER = 6
 
static const int TEXTURE_SLOT_BLUR_BUFFER = 7
 
static const int TEXTURE_SLOT_APPLY_SOURCE = 9
 
static const int TEXTURE_SLOT_APPLY_TEXTURE_ADD = 10
 
static const int TEXTURE_SLOT_GEOM_PASS_OUT_POSITION = 11
 
static const int TEXTURE_SLOT_GEOM_PASS_OUT_NORMAL = 12
 
static const int TEXTURE_SLOT_GEOM_PASS_OUT_COLOR = 13
 
static const int TEXTURE_SLOT_GEOM_PASS_OUT_PHONG_DIFFUSE = 14
 
static const int TEXTURE_SLOT_GEOM_PASS_OUT_PHONG_SPECULAR = 15
 
static const int TEXTURE_SLOT_GEOM_PASS_OUT_PHONG_SHININESS = 16
 
static const int TEXTURE_SLOT_LIGHTING_PASS_OUT_COLOR = 17
 
static const int TEXTURE_SLOT_LIGHTING_PASS_OUT_BRIGHT_COLOR = 18
 
static const int LIGHTS_MAX_POINT = 50
 
static const int LIGHTS_MAX_SPOT = 50
 
static const int COLOR_ATTACHMENT_GEOM_PASS_OUT_POSITION = 0
 
static const int COLOR_ATTACHMENT_GEOM_PASS_OUT_NORMAL = 1
 
static const int COLOR_ATTACHMENT_GEOM_PASS_OUT_COLOR = 2
 
static const int COLOR_ATTACHMENT_GEOM_PASS_OUT_PHONG_DIFFUSE = 3
 
static const int COLOR_ATTACHMENT_GEOM_PASS_OUT_PHONG_SPECULAR = 4
 
static const int COLOR_ATTACHMENT_GEOM_PASS_OUT_PHONG_SHININESS = 5
 
static const int COLOR_ATTACHMENT_LIGHTING_PASS_OUT_COLOR = 0
 
static const int COLOR_ATTACHMENT_LIGHTING_PASS_OUT_BRIGHT_COLOR = 1
 
static const int MESH_RESTART_INDEX = -1
 

Detailed Description

Base abstract render context class.

Definition at line 54 of file render_context.h.

Constructor & Destructor Documentation

◆ render_context()

scl::render_context::render_context ( )
inline

Render context methods.

Default render context constructor.

Definition at line 100 of file render_context.h.

100{};

◆ ~render_context()

virtual scl::render_context::~render_context ( )
inlinevirtual

Default render context destructor.

Definition at line 103 of file render_context.h.

103{};

Member Function Documentation

◆ Close()

virtual void scl::render_context::Close ( )
pure virtual
  • Render context deinitialisation function.
Parameters
None.
Returns
None.

Implemented in scl::gl.

◆ Create()

scl::unique< scl::render_context > scl::render_context::Create ( )
static
  • Rendering context creation function.
Parameters
None.
Returns
pointer to created rendering context.

Definition at line 59 of file render_context.cpp.

60{
61 switch (Api)
62 {
63 case scl::render_context_api::OpenGL: return CreateUnique<gl>();
64 case scl::render_context_api::DirectX: SCL_CORE_ASSERT(0, "This API is currently unsupported."); return nullptr;
65 }
66
67 SCL_CORE_ERROR("Unknown render API was selected.");
68 return nullptr;
69}
#define SCL_CORE_ASSERT(expr,...)
Definition: assert.h:69
#define SCL_CORE_ERROR(...)
Definition: log.h:44

◆ DrawIndices()

virtual void scl::render_context::DrawIndices ( const shared< vertex_array > &  Mesh)
pure virtual
  • Draw vertices function.
Parameters
Mesh- mesh, containing vertices and vertex indices to draw.
Returns
None.

Implemented in scl::gl.

◆ DrawIndicesInstanced()

virtual void scl::render_context::DrawIndicesInstanced ( const shared< vertex_array > &  Mesh,
int  InstanceCount 
)
pure virtual
  • Draw vertices instanced function.
Parameters
Mesh- mesh, containing vertices and vertex indices to draw.
Returns
None.

Implemented in scl::gl.

◆ GetApi()

static render_context_api scl::render_context::GetApi ( )
inlinestatic

Render system backend api.

Render context data getter/setter functions.

Rendering context backend API getter function.

Definition at line 61 of file render_context.h.

61{ return Api; }

◆ GetClearColor()

virtual const vec4 & scl::render_context::GetClearColor ( ) const
pure virtual

Frame clear color setter function.

Implemented in scl::gl.

◆ GetCullingMode()

virtual render_cull_face_mode scl::render_context::GetCullingMode ( ) const
pure virtual

Render culling mode setter function.

Implemented in scl::gl.

◆ GetGaussianBlurPassShader()

virtual shared< shader_program > scl::render_context::GetGaussianBlurPassShader ( ) const
pure virtual

Backend API specific gaussian blur pass shader getter function.

Implemented in scl::gl.

◆ GetPhongGeometryShader()

virtual shared< shader_program > scl::render_context::GetPhongGeometryShader ( ) const
pure virtual

Backend API specific phong lighint model shader for geometry pass getter function.

Implemented in scl::gl.

◆ GetPhongLightingShader()

virtual shared< shader_program > scl::render_context::GetPhongLightingShader ( ) const
pure virtual

Backend API specific phong lighint model shader for lighting pass getter function.

Implemented in scl::gl.

◆ GetShaderVariableComponentsCount()

scl::u32 scl::render_context::GetShaderVariableComponentsCount ( shader_variable_type  Type)
static
  • Get components count of specified shader variable type fucntion.
Parameters
Type- shader variable type to get components count of.
Returns
components count of specified type.

Definition at line 36 of file render_context.cpp.

◆ GetShaderVariableTypeSize()

scl::u32 scl::render_context::GetShaderVariableTypeSize ( shader_variable_type  Type)
static
  • Get size of specified shader variable type fucntion.
Parameters
Type- shader variable type to get size of.
Returns
size of specified type.

Definition at line 15 of file render_context.cpp.

16{
17 switch (Type)
18 {
20 case scl::shader_variable_type::INT: return 4;
22 case scl::shader_variable_type::INT3: return 12;
23 case scl::shader_variable_type::INT4: return 16;
30 }
31
32 SCL_CORE_ASSERT(0, "Unknown shader variable type!");
33 return u32();
34}

◆ GetShadowPassShader()

virtual shared< shader_program > scl::render_context::GetShadowPassShader ( ) const
pure virtual

Backend API specific shadow pass shader getter function.

Implemented in scl::gl.

◆ GetSingleColorMaterialShader()

virtual shared< shader_program > scl::render_context::GetSingleColorMaterialShader ( ) const
pure virtual

Sculpto library built-in backend API specific rendering objects getter function.

Backend API specific single color material shader getter function.

Implemented in scl::gl.

◆ GetTextureAddPassShader()

virtual shared< shader_program > scl::render_context::GetTextureAddPassShader ( ) const
pure virtual

Backend API specific gaussian blur pass shader getter function.

Implemented in scl::gl.

◆ GetToneMappingPassShader()

virtual shared< shader_program > scl::render_context::GetToneMappingPassShader ( ) const
pure virtual

Backend API specific tone mapping pass shader getter function.

Implemented in scl::gl.

◆ GetVSync()

virtual bool scl::render_context::GetVSync ( ) const
pure virtual

Render virtual syncronisation flag getter function.

Implemented in scl::gl.

◆ GetWireframeMode()

virtual bool scl::render_context::GetWireframeMode ( ) const
pure virtual

Render wire frame mode setter function.

Implemented in scl::gl.

◆ Init()

virtual void scl::render_context::Init ( )
pure virtual
  • Render context initialisation function.
Parameters
None.
Returns
None.

Implemented in scl::gl.

◆ SetClearColor()

virtual void scl::render_context::SetClearColor ( const vec4 ClearColor)
pure virtual

Frame clear color setter function.

Implemented in scl::gl.

◆ SetCullingMode()

virtual void scl::render_context::SetCullingMode ( render_cull_face_mode  CullingMode)
pure virtual

Render culling mode setter function.

Implemented in scl::gl.

◆ SetVSync()

virtual void scl::render_context::SetVSync ( bool  VSync)
pure virtual

Render virtual syncronisation flag setter function.

Implemented in scl::gl.

◆ SetWireframeMode()

virtual void scl::render_context::SetWireframeMode ( bool  IsWireframe)
pure virtual

Render wire frame mode setter function.

Implemented in scl::gl.

◆ SwapBuffers()

virtual void scl::render_context::SwapBuffers ( )
pure virtual
  • Swap frame buffers function.
Parameters
None.
Returns
None.

Implemented in scl::gl.

Member Data Documentation

◆ BINDING_POINT_FREE

const int scl::render_context::BINDING_POINT_FREE = 20
static

Definition at line 174 of file render_context.h.

◆ BINDING_POINT_LIGHTS_STORAGE

const int scl::render_context::BINDING_POINT_LIGHTS_STORAGE = 10
static

Definition at line 172 of file render_context.h.

◆ BINDING_POINT_MATERIAL_DATA

const int scl::render_context::BINDING_POINT_MATERIAL_DATA = 5
static

Definition at line 171 of file render_context.h.

◆ BINDING_POINT_SCENE_DATA

const int scl::render_context::BINDING_POINT_SCENE_DATA = 0
static

Rendering context shader constants.

Definition at line 170 of file render_context.h.

◆ BINDING_POINT_SHADOW_CASTERS_STORAGE

const int scl::render_context::BINDING_POINT_SHADOW_CASTERS_STORAGE = 11
static

Definition at line 173 of file render_context.h.

◆ COLOR_ATTACHMENT_GEOM_PASS_OUT_COLOR

const int scl::render_context::COLOR_ATTACHMENT_GEOM_PASS_OUT_COLOR = 2
static

Definition at line 199 of file render_context.h.

◆ COLOR_ATTACHMENT_GEOM_PASS_OUT_NORMAL

const int scl::render_context::COLOR_ATTACHMENT_GEOM_PASS_OUT_NORMAL = 1
static

Definition at line 198 of file render_context.h.

◆ COLOR_ATTACHMENT_GEOM_PASS_OUT_PHONG_DIFFUSE

const int scl::render_context::COLOR_ATTACHMENT_GEOM_PASS_OUT_PHONG_DIFFUSE = 3
static

Definition at line 200 of file render_context.h.

◆ COLOR_ATTACHMENT_GEOM_PASS_OUT_PHONG_SHININESS

const int scl::render_context::COLOR_ATTACHMENT_GEOM_PASS_OUT_PHONG_SHININESS = 5
static

Definition at line 202 of file render_context.h.

◆ COLOR_ATTACHMENT_GEOM_PASS_OUT_PHONG_SPECULAR

const int scl::render_context::COLOR_ATTACHMENT_GEOM_PASS_OUT_PHONG_SPECULAR = 4
static

Definition at line 201 of file render_context.h.

◆ COLOR_ATTACHMENT_GEOM_PASS_OUT_POSITION

const int scl::render_context::COLOR_ATTACHMENT_GEOM_PASS_OUT_POSITION = 0
static

Definition at line 197 of file render_context.h.

◆ COLOR_ATTACHMENT_LIGHTING_PASS_OUT_BRIGHT_COLOR

const int scl::render_context::COLOR_ATTACHMENT_LIGHTING_PASS_OUT_BRIGHT_COLOR = 1
static

Definition at line 204 of file render_context.h.

◆ COLOR_ATTACHMENT_LIGHTING_PASS_OUT_COLOR

const int scl::render_context::COLOR_ATTACHMENT_LIGHTING_PASS_OUT_COLOR = 0
static

Definition at line 203 of file render_context.h.

◆ LIGHTS_MAX_POINT

const int scl::render_context::LIGHTS_MAX_POINT = 50
static

Definition at line 194 of file render_context.h.

◆ LIGHTS_MAX_SPOT

const int scl::render_context::LIGHTS_MAX_SPOT = 50
static

Definition at line 195 of file render_context.h.

◆ MESH_RESTART_INDEX

const int scl::render_context::MESH_RESTART_INDEX = -1
static

Definition at line 206 of file render_context.h.

◆ TEXTURE_SLOT_APPLY_SOURCE

const int scl::render_context::TEXTURE_SLOT_APPLY_SOURCE = 9
static

Definition at line 183 of file render_context.h.

◆ TEXTURE_SLOT_APPLY_TEXTURE_ADD

const int scl::render_context::TEXTURE_SLOT_APPLY_TEXTURE_ADD = 10
static

Definition at line 184 of file render_context.h.

◆ TEXTURE_SLOT_BLUR_BUFFER

const int scl::render_context::TEXTURE_SLOT_BLUR_BUFFER = 7
static

Definition at line 182 of file render_context.h.

◆ TEXTURE_SLOT_GEOM_PASS_OUT_COLOR

const int scl::render_context::TEXTURE_SLOT_GEOM_PASS_OUT_COLOR = 13
static

Definition at line 187 of file render_context.h.

◆ TEXTURE_SLOT_GEOM_PASS_OUT_NORMAL

const int scl::render_context::TEXTURE_SLOT_GEOM_PASS_OUT_NORMAL = 12
static

Definition at line 186 of file render_context.h.

◆ TEXTURE_SLOT_GEOM_PASS_OUT_PHONG_DIFFUSE

const int scl::render_context::TEXTURE_SLOT_GEOM_PASS_OUT_PHONG_DIFFUSE = 14
static

Definition at line 188 of file render_context.h.

◆ TEXTURE_SLOT_GEOM_PASS_OUT_PHONG_SHININESS

const int scl::render_context::TEXTURE_SLOT_GEOM_PASS_OUT_PHONG_SHININESS = 16
static

Definition at line 190 of file render_context.h.

◆ TEXTURE_SLOT_GEOM_PASS_OUT_PHONG_SPECULAR

const int scl::render_context::TEXTURE_SLOT_GEOM_PASS_OUT_PHONG_SPECULAR = 15
static

Definition at line 189 of file render_context.h.

◆ TEXTURE_SLOT_GEOM_PASS_OUT_POSITION

const int scl::render_context::TEXTURE_SLOT_GEOM_PASS_OUT_POSITION = 11
static

Definition at line 185 of file render_context.h.

◆ TEXTURE_SLOT_HDR_BUFFER

const int scl::render_context::TEXTURE_SLOT_HDR_BUFFER = 6
static

Definition at line 181 of file render_context.h.

◆ TEXTURE_SLOT_LIGHTING_PASS_OUT_BRIGHT_COLOR

const int scl::render_context::TEXTURE_SLOT_LIGHTING_PASS_OUT_BRIGHT_COLOR = 18
static

Definition at line 192 of file render_context.h.

◆ TEXTURE_SLOT_LIGHTING_PASS_OUT_COLOR

const int scl::render_context::TEXTURE_SLOT_LIGHTING_PASS_OUT_COLOR = 17
static

Definition at line 191 of file render_context.h.

◆ TEXTURE_SLOT_MATERIAL_DIFFUSE

const int scl::render_context::TEXTURE_SLOT_MATERIAL_DIFFUSE = 0
static

Definition at line 176 of file render_context.h.

◆ TEXTURE_SLOT_MATERIAL_EMISSION_MAP

const int scl::render_context::TEXTURE_SLOT_MATERIAL_EMISSION_MAP = 2
static

Definition at line 178 of file render_context.h.

◆ TEXTURE_SLOT_MATERIAL_NORMAL_MAP

const int scl::render_context::TEXTURE_SLOT_MATERIAL_NORMAL_MAP = 3
static

Definition at line 179 of file render_context.h.

◆ TEXTURE_SLOT_MATERIAL_SPECULAR

const int scl::render_context::TEXTURE_SLOT_MATERIAL_SPECULAR = 1
static

Definition at line 177 of file render_context.h.

◆ TEXTURE_SLOT_SHADOW_MAP

const int scl::render_context::TEXTURE_SLOT_SHADOW_MAP = 5
static

Definition at line 180 of file render_context.h.


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