Castor3D
..
|
The render system representation. More...
Classes | |
struct | ObjectDeclaration |
Public Member Functions | |
C3D_API | RenderSystem (Engine &p_engine, eRENDERER_TYPE p_eRendererType) |
Constructor. More... | |
virtual C3D_API | ~RenderSystem () |
Destructor. More... | |
C3D_API void | Initialise () |
Initialises the render system. More... | |
C3D_API void | Cleanup () |
Cleans the render system up. More... | |
C3D_API ShaderProgramSPtr | CreateShaderProgram (eSHADER_LANGUAGE p_langage) |
Creates a ShaderProgram in a given language. More... | |
C3D_API void | RenderAmbientLight (Castor::Colour const &p_clColour, FrameVariableBuffer &p_variableBuffer) |
Renders the scene ambient lighting. More... | |
C3D_API void | PushScene (Scene *p_scene) |
Pushes a scene on th stack. More... | |
C3D_API void | PopScene () |
Pops a scene from the stack. More... | |
C3D_API Scene * | GetTopScene () |
Retrieves the top scene from the stack. More... | |
C3D_API Camera * | GetCurrentCamera () const |
Retrieves the currently active camera. More... | |
C3D_API void | SetCurrentCamera (Camera *p_pCamera) |
Defines the currently active camera. More... | |
C3D_API GLSL::GlslWriter | CreateGlslWriter () |
C3D_API ShaderProgramSPtr | CreateBillboardsProgram (RenderTechnique const &p_technique, uint32_t p_flags) |
Creates a shader program for billboards rendering use. More... | |
C3D_API Castor::String | GetVertexShaderSource (uint32_t p_programFlags) |
Retrieves the vertex shader source matching the given flags. More... | |
bool | CheckSupport (eSHADER_MODEL p_model) |
Checks support for given shader model. More... | |
eSHADER_MODEL | GetMaxShaderModel () |
virtual C3D_API GeometryBuffersSPtr | CreateGeometryBuffers (eTOPOLOGY p_topology, ShaderProgram const &p_program, VertexBuffer *p_vtx, IndexBuffer *p_idx, VertexBuffer *p_bones, VertexBuffer *p_inst)=0 |
Creates a geometries buffer holder. More... | |
virtual C3D_API ContextSPtr | CreateContext ()=0 |
Creates a rendering context. More... | |
virtual C3D_API FrameVariableBufferSPtr | CreateFrameVariableBuffer (Castor::String const &p_name)=0 |
Creates a FrameVariableBuffer. More... | |
virtual C3D_API DepthStencilStateSPtr | CreateDepthStencilState ()=0 |
Create a depth and stencil states object. More... | |
virtual C3D_API RasteriserStateSPtr | CreateRasteriserState ()=0 |
Create a rasteriser states object. More... | |
virtual C3D_API BlendStateSPtr | CreateBlendState ()=0 |
Create a blender states object. More... | |
virtual C3D_API SamplerSPtr | CreateSampler (Castor::String const &p_name)=0 |
Create a sampler. More... | |
virtual C3D_API ShaderProgramSPtr | CreateShaderProgram ()=0 |
Creates a ShaderProgram (GLSL or HLSL only) More... | |
virtual C3D_API StaticTextureSPtr | CreateStaticTexture ()=0 |
Creates a texture. More... | |
virtual C3D_API DynamicTextureSPtr | CreateDynamicTexture (uint8_t p_cpuAccess, uint8_t p_gpuAccess)=0 |
Creates a texture. More... | |
virtual C3D_API std::shared_ptr< GpuBuffer< uint8_t > > | CreateVertexBuffer (CpuBuffer< uint8_t > *p_buffer)=0 |
Creates a vertex buffer. More... | |
virtual C3D_API std::shared_ptr< GpuBuffer< uint32_t > > | CreateIndexBuffer (CpuBuffer< uint32_t > *p_buffer)=0 |
Creates an index buffer. More... | |
virtual C3D_API IPipelineImplSPtr | GetPipelineImpl ()=0 |
virtual C3D_API FrameBufferSPtr | CreateFrameBuffer ()=0 |
Creates a frame buffer. More... | |
virtual C3D_API BackBuffersSPtr | CreateBackBuffers ()=0 |
Creates the window back buffers. More... | |
virtual C3D_API GpuQuerySPtr | CreateQuery (eQUERY_TYPE p_type)=0 |
Creates a GPU query. More... | |
bool | HasShaderType (eSHADER_TYPE p_type) const |
Tells if the RenderSystem supports given shader type. More... | |
bool | IsInitialised () const |
Tells if the RenderSystem is initialised. More... | |
bool | IsStereoAvailable () const |
Tells if the RenderSystem supports stereo. More... | |
void | SetStereoAvailable (bool p_bStereo) |
Defines if the RenderSystem supports stereo. More... | |
Pipeline const & | GetPipeline () const |
Retrieves the pipeline. More... | |
Pipeline & | GetPipeline () |
Retrieves the pipeline. More... | |
eRENDERER_TYPE | GetRendererType () const |
Retrieves the renderer API. More... | |
bool | HasInstancing () const |
Retrieves the instanced draw calls support. More... | |
bool | HasAccumulationBuffer () const |
Retrieves the accumulation buffer support. More... | |
bool | HasNonPowerOfTwoTextures () const |
Retrieves the non power of two textures support. More... | |
void | SetMainContext (ContextSPtr p_context) |
Sets the main render context. More... | |
ContextSPtr | GetMainContext () |
Retrieves the main render context. More... | |
void | SetCurrentContext (Context *p_context) |
Sets the currently active render context. More... | |
Context * | GetCurrentContext () |
Retrieves the currently active render context. More... | |
OverlayRendererSPtr | GetOverlayRenderer () |
Retrieves the overlay renderer. More... | |
template<class Rep , class Period > | |
void | IncGpuTime (std::chrono::duration< Rep, Period > const &p_time) |
Increments the GPU time. More... | |
void | ResetGpuTime () |
Resets the GPU time. More... | |
std::chrono::milliseconds | GetGpuTime () const |
Retrieves the GPU time. More... | |
uint32_t | GetShaderLanguageVersion () const |
bool | HasConstantsBuffers () const |
bool | HasTextureBuffers () const |
Protected Member Functions | |
virtual C3D_API void | DoInitialise ()=0 |
Initialises the render system. More... | |
virtual C3D_API void | DoCleanup ()=0 |
Cleans the render system up. More... | |
template<typename T > | |
bool | DoTrack (T *p_object, std::string const &p_type, std::string const &p_file, int p_line, std::string &p_name) |
bool | DoTrack (Castor::Named *p_object, std::string const &p_type, std::string const &p_file, int p_line, std::string &p_name) |
template<typename T > | |
bool | DoUntrack (T *p_object, ObjectDeclaration &p_declaration) |
C3D_API void | DoReportTracked () |
Protected Attributes | |
std::recursive_mutex | m_mutex |
Mutex used to make this class thread safe. More... | |
bool | m_initialised |
Tells whether or not it is initialised. More... | |
bool | m_instancing |
Tells whether or not the selected render API supports instanced draw calls. More... | |
bool | m_accumBuffer |
Tells whether or not the selected render API supports accumulation buffers. More... | |
bool | m_nonPowerOfTwoTextures |
Tells whether or not the selected render API supports non power of two textures. More... | |
bool | m_stereoAvailable |
Tells the RenderSystem supports stereo. More... | |
bool | m_useShader [eSHADER_TYPE_COUNT] |
Tells which types of shaders are supported. More... | |
eSHADER_MODEL | m_maxShaderModel |
The maximum supported shader model. More... | |
OverlayRendererSPtr | m_overlayRenderer |
The overlay renderer. More... | |
ContextSPtr | m_mainContext |
The main render context. More... | |
ContextRPtr | m_currentContext |
The currently active render context. More... | |
std::unique_ptr< Pipeline > | m_pipeline |
The matrix pipeline. More... | |
std::stack< SceneRPtr > | m_stackScenes |
Scene stack. More... | |
eRENDERER_TYPE | m_rendererType |
The current loaded renderer api type. More... | |
CameraRPtr | m_pCurrentCamera |
The currently active camera. More... | |
std::chrono::milliseconds | m_gpuTime |
The time spent on GPU for current frame. More... | |
uint32_t | m_shaderLanguageVersion |
The shader language version. More... | |
bool | m_hasConstantsBuffers |
The constants buffers support status. More... | |
bool | m_hasTextureBuffers |
The texture buffers support status. More... | |
uint32_t | m_id = 0 |
std::list< ObjectDeclaration > | m_allocated |
Friends | |
template<class Ty > | |
struct | RendererCreator |
template<class Ty > | |
struct | RendererAdder |
The render system representation.
C3D_API Castor3D::RenderSystem::RenderSystem | ( | Engine & | p_engine, |
eRENDERER_TYPE | p_eRendererType | ||
) |
Constructor.
[in] | p_engine | The engine |
[in] | p_eRendererType | The render API |
|
virtual |
Destructor.
|
inline |
Checks support for given shader model.
[in] | p_model | The shader model |
false
if the given model is not supported by current API References m_maxShaderModel.
C3D_API void Castor3D::RenderSystem::Cleanup | ( | ) |
Cleans the render system up.
|
pure virtual |
Creates the window back buffers.
C3D_API ShaderProgramSPtr Castor3D::RenderSystem::CreateBillboardsProgram | ( | RenderTechnique const & | p_technique, |
uint32_t | p_flags | ||
) |
Creates a shader program for billboards rendering use.
|
pure virtual |
Create a blender states object.
|
pure virtual |
Creates a rendering context.
|
pure virtual |
Create a depth and stencil states object.
|
pure virtual |
Creates a texture.
[in] | p_cpuAccess | The required CPU access (combination of eACCESS_TYPE). |
[in] | p_gpuAccess | The required GPU access (combination of eACCESS_TYPE). |
|
pure virtual |
Creates a frame buffer.
|
pure virtual |
Creates a FrameVariableBuffer.
|
pure virtual |
Creates a geometries buffer holder.
[in] | p_topology | The buffers topology. |
[in] | p_program | The shader program. |
[in] | p_vtx | The vertex buffer. |
[in] | p_idx | The index buffer. |
[in] | p_bones | The bones data buffer. |
[in] | p_inst | The instances matrices buffer. |
C3D_API GLSL::GlslWriter Castor3D::RenderSystem::CreateGlslWriter | ( | ) |
|
pure virtual |
Creates an index buffer.
[in] | p_buffer | The hardware buffer to which the index buffer will be linked |
|
pure virtual |
Creates a GPU query.
[in] | p_type | The query type. |
|
pure virtual |
Create a rasteriser states object.
|
pure virtual |
Create a sampler.
[in] | p_name | The sampler name |
Referenced by Castor3D::SamplerManager::Create().
C3D_API ShaderProgramSPtr Castor3D::RenderSystem::CreateShaderProgram | ( | eSHADER_LANGUAGE | p_langage | ) |
Creates a ShaderProgram in a given language.
[in] | p_langage | The shader language |
|
pure virtual |
Creates a ShaderProgram (GLSL or HLSL only)
|
pure virtual |
Creates a texture.
|
pure virtual |
Creates a vertex buffer.
[in] | p_buffer | The hardware buffer to which the vertex buffer will be linked |
|
protectedpure virtual |
Cleans the render system up.
|
protectedpure virtual |
Initialises the render system.
|
protected |
|
inlineprotected |
References m_allocated, and m_id.
Referenced by DoTrack().
|
inlineprotected |
|
inlineprotected |
References m_allocated, and Castor3D::RenderSystem::ObjectDeclaration::m_ref.
C3D_API Camera* Castor3D::RenderSystem::GetCurrentCamera | ( | ) | const |
Retrieves the currently active camera.
|
inline |
|
inline |
|
inline |
|
inline |
References m_maxShaderModel.
|
inline |
|
inline |
Retrieves the pipeline.
References m_pipeline.
|
inline |
Retrieves the pipeline.
References m_pipeline.
|
pure virtual |
|
inline |
Retrieves the renderer API.
References m_rendererType.
|
inline |
References m_shaderLanguageVersion.
C3D_API Scene* Castor3D::RenderSystem::GetTopScene | ( | ) |
Retrieves the top scene from the stack.
C3D_API Castor::String Castor3D::RenderSystem::GetVertexShaderSource | ( | uint32_t | p_programFlags | ) |
Retrieves the vertex shader source matching the given flags.
[in] | p_programFlags | Bitwise ORed ePROGRAM_FLAG |
|
inline |
|
inline |
References m_hasConstantsBuffers.
|
inline |
|
inline |
Retrieves the non power of two textures support.
References m_nonPowerOfTwoTextures.
|
inline |
Tells if the RenderSystem supports given shader type.
[in] | p_type | The shader type |
References m_useShader.
|
inline |
References m_hasTextureBuffers.
|
inline |
C3D_API void Castor3D::RenderSystem::Initialise | ( | ) |
Initialises the render system.
|
inline |
Tells if the RenderSystem is initialised.
References m_initialised.
|
inline |
Tells if the RenderSystem supports stereo.
References m_stereoAvailable.
C3D_API void Castor3D::RenderSystem::PopScene | ( | ) |
Pops a scene from the stack.
C3D_API void Castor3D::RenderSystem::PushScene | ( | Scene * | p_scene | ) |
Pushes a scene on th stack.
[in] | p_scene | The scene |
C3D_API void Castor3D::RenderSystem::RenderAmbientLight | ( | Castor::Colour const & | p_clColour, |
FrameVariableBuffer & | p_variableBuffer | ||
) |
Renders the scene ambient lighting.
[in] | p_clColour | The light colour |
[in] | p_variableBuffer | The variable buffer that receives the ambient light |
|
inline |
Resets the GPU time.
References m_gpuTime.
C3D_API void Castor3D::RenderSystem::SetCurrentCamera | ( | Camera * | p_pCamera | ) |
Defines the currently active camera.
[in] | p_pCamera | The camera |
|
inline |
Sets the currently active render context.
[in] | p_context | The context |
References m_currentContext.
|
inline |
|
inline |
Defines if the RenderSystem supports stereo.
References m_stereoAvailable.
|
friend |
|
friend |
|
protected |
Tells whether or not the selected render API supports accumulation buffers.
Referenced by HasAccumulationBuffer().
|
protected |
Referenced by DoTrack(), and DoUntrack().
|
protected |
The currently active render context.
Referenced by GetCurrentContext(), and SetCurrentContext().
|
protected |
The time spent on GPU for current frame.
Referenced by GetGpuTime(), IncGpuTime(), and ResetGpuTime().
|
protected |
The constants buffers support status.
Referenced by HasConstantsBuffers().
|
protected |
The texture buffers support status.
Referenced by HasTextureBuffers().
|
protected |
Referenced by DoTrack().
|
protected |
Tells whether or not it is initialised.
Referenced by IsInitialised().
|
protected |
Tells whether or not the selected render API supports instanced draw calls.
Referenced by HasInstancing().
|
protected |
The main render context.
Referenced by GetMainContext(), and SetMainContext().
|
protected |
The maximum supported shader model.
Referenced by CheckSupport(), and GetMaxShaderModel().
|
protected |
Mutex used to make this class thread safe.
|
protected |
Tells whether or not the selected render API supports non power of two textures.
Referenced by HasNonPowerOfTwoTextures().
|
protected |
The overlay renderer.
Referenced by GetOverlayRenderer().
|
protected |
The currently active camera.
|
protected |
The matrix pipeline.
Referenced by GetPipeline().
|
protected |
The current loaded renderer api type.
Referenced by GetRendererType().
|
protected |
The shader language version.
Referenced by GetShaderLanguageVersion().
|
protected |
Scene stack.
|
protected |
Tells the RenderSystem supports stereo.
Referenced by IsStereoAvailable(), and SetStereoAvailable().
|
protected |
Tells which types of shaders are supported.
Referenced by HasShaderType().