Pioneer
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Graphics::RendererOGL Class Referencefinal

#include <RendererGL.h>

Inheritance diagram for Graphics::RendererOGL:
Inheritance graph
[legend]
Collaboration diagram for Graphics::RendererOGL:
Collaboration graph
[legend]

Public Member Functions

 RendererOGL (SDL_Window *window, const Graphics::Settings &vs, SDL_GLContext &glContext)
 
virtual ~RendererOGL () override final
 
virtual const char * GetName () const override final
 
virtual RendererType GetRendererType () const override final
 
virtual void WriteRendererInfo (std::ostream &out) const override final
 
virtual void CheckRenderErrors (const char *func=nullptr, const int line=-1) const override final
 
virtual bool SupportsInstancing () override final
 
virtual int GetMaximumNumberAASamples () const override final
 
virtual bool GetNearFarRange (float &near_, float &far_) const override final
 
virtual bool BeginFrame () override final
 
virtual bool EndFrame () override final
 
virtual bool SwapBuffers () override final
 
virtual bool SetRenderState (RenderState *) override final
 
virtual bool SetRenderTarget (RenderTarget *) override final
 
virtual bool SetDepthRange (double znear, double zfar) override final
 
virtual bool ResetDepthRange () override final
 
virtual bool ClearScreen () override final
 
virtual bool ClearDepthBuffer () override final
 
virtual bool SetClearColor (const Color &c) override final
 
virtual bool SetViewport (Viewport v) override final
 
virtual Viewport GetViewport () const override final
 
virtual bool SetTransform (const matrix4x4f &m) override final
 
virtual matrix4x4f GetTransform () const override final
 
virtual bool SetPerspectiveProjection (float fov, float aspect, float near_, float far_) override final
 
virtual bool SetOrthographicProjection (float xmin, float xmax, float ymin, float ymax, float zmin, float zmax) override final
 
virtual bool SetProjection (const matrix4x4f &m) override final
 
virtual matrix4x4f GetProjection () const override final
 
virtual bool SetWireFrameMode (bool enabled) override final
 
virtual bool SetLights (Uint32 numlights, const Light *l) override final
 
virtual Uint32 GetNumLights () const override final
 
virtual bool SetAmbientColor (const Color &c) override final
 
virtual bool SetScissor (bool enabled, const vector2f &pos=vector2f(0.0f), const vector2f &size=vector2f(0.0f)) override final
 
virtual bool DrawTriangles (const VertexArray *vertices, RenderState *state, Material *material, PrimitiveType type=TRIANGLES) override final
 
virtual bool DrawPointSprites (const Uint32 count, const vector3f *positions, RenderState *rs, Material *material, float size) override final
 
virtual bool DrawPointSprites (const Uint32 count, const vector3f *positions, const vector2f *offsets, const float *sizes, RenderState *rs, Material *material) override final
 
virtual bool DrawBuffer (VertexBuffer *, RenderState *, Material *, PrimitiveType) override final
 
virtual bool DrawBufferIndexed (VertexBuffer *, IndexBuffer *, RenderState *, Material *, PrimitiveType) override final
 
virtual bool DrawBufferInstanced (VertexBuffer *, RenderState *, Material *, InstanceBuffer *, PrimitiveType type=TRIANGLES) override final
 
virtual bool DrawBufferIndexedInstanced (VertexBuffer *, IndexBuffer *, RenderState *, Material *, InstanceBuffer *, PrimitiveType=TRIANGLES) override final
 
virtual MaterialCreateMaterial (const MaterialDescriptor &descriptor) override final
 
virtual TextureCreateTexture (const TextureDescriptor &descriptor) override final
 
virtual RenderStateCreateRenderState (const RenderStateDesc &) override final
 
virtual RenderTargetCreateRenderTarget (const RenderTargetDesc &) override final
 
virtual VertexBufferCreateVertexBuffer (const VertexBufferDesc &) override final
 
virtual IndexBufferCreateIndexBuffer (Uint32 size, BufferUsage) override final
 
virtual InstanceBufferCreateInstanceBuffer (Uint32 size, BufferUsage) override final
 
virtual bool ReloadShaders () override final
 
virtual bool Screendump (ScreendumpState &sd) override final
 
virtual bool FrameGrab (ScreendumpState &sd) override final
 
- Public Member Functions inherited from Graphics::Renderer
 Renderer (SDL_Window *win, int width, int height)
 
virtual ~Renderer ()
 
SDL_Window * GetSDLWindow () const
 
float GetDisplayAspect () const
 
int GetWindowWidth () const
 
int GetWindowHeight () const
 
const LightGetLight (const Uint32 idx) const
 
const ColorGetAmbientColor () const
 
TextureGetCachedTexture (const std::string &type, const std::string &name)
 
void AddCachedTexture (const std::string &type, const std::string &name, Texture *texture)
 
void RemoveCachedTexture (const std::string &type, const std::string &name)
 
void RemoveAllCachedTextures ()
 
const TextureCacheGetTextureCache ()
 
StatsGetStats ()
 

Static Public Member Functions

static void RegisterRenderer ()
 
static void CheckErrors (const char *func=nullptr, const int line=-1)
 

Protected Member Functions

virtual void PushState () override final
 
virtual void PopState () override final
 
void SetMaterialShaderTransforms (Material *)
 
matrix4x4fGetCurrentTransform ()
 
OGL::ProgramGetOrCreateProgram (OGL::Material *)
 

Protected Attributes

Uint32 m_numLights
 
Uint32 m_numDirLights
 
std::vector< GLuint > m_vertexAttribsSet
 
float m_minZNear
 
float m_maxZFar
 
bool m_useCompressedTextures
 
bool m_useAnisotropicFiltering
 
matrix4x4f m_currentTransform
 
std::vector< std::pair< MaterialDescriptor, OGL::Program * > > m_programs
 
std::unordered_map< Uint32, OGL::RenderState * > m_renderStates
 
bool m_useNVDepthRanged
 
float m_invLogZfarPlus1
 
OGL::RenderTargetm_activeRenderTarget = nullptr
 
OGL::RenderTargetm_windowRenderTarget = nullptr
 
RenderStatem_activeRenderState = nullptr
 
matrix4x4f m_modelViewMat
 
matrix4x4f m_projectionMat
 
Viewport m_viewport
 
- Protected Attributes inherited from Graphics::Renderer
int m_width
 
int m_height
 
Color m_ambient
 
Light m_lights [4]
 
Stats m_stats
 
SDL_Window * m_window
 

Friends

class OGL::Material
 
class OGL::GasGiantSurfaceMaterial
 
class OGL::GeoSphereSurfaceMaterial
 
class OGL::GeoSphereSkyMaterial
 
class OGL::GeoSphereStarMaterial
 
class OGL::GenGasGiantColourMaterial
 
class OGL::MultiMaterial
 
class OGL::LitMultiMaterial
 
class OGL::RingMaterial
 
class OGL::FresnelColourMaterial
 
class OGL::ShieldMaterial
 
class OGL::BillboardMaterial
 

Additional Inherited Members

- Public Types inherited from Graphics::Renderer
using TextureCache = TextureCacheMap
 

Constructor & Destructor Documentation

◆ RendererOGL()

Graphics::RendererOGL::RendererOGL ( SDL_Window *  window,
const Graphics::Settings vs,
SDL_GLContext &  glContext 
)
Here is the call graph for this function:

◆ ~RendererOGL()

Graphics::RendererOGL::~RendererOGL ( )
finaloverridevirtual
Here is the call graph for this function:

Member Function Documentation

◆ BeginFrame()

bool Graphics::RendererOGL::BeginFrame ( )
finaloverridevirtual

Implements Graphics::Renderer.

◆ CheckErrors()

void Graphics::RendererOGL::CheckErrors ( const char *  func = nullptr,
const int  line = -1 
)
static
Here is the call graph for this function:

◆ CheckRenderErrors()

virtual void Graphics::RendererOGL::CheckRenderErrors ( const char *  func = nullptr,
const int  line = -1 
) const
inlinefinaloverridevirtual

Reimplemented from Graphics::Renderer.

Here is the call graph for this function:

◆ ClearDepthBuffer()

bool Graphics::RendererOGL::ClearDepthBuffer ( )
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ ClearScreen()

bool Graphics::RendererOGL::ClearScreen ( )
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ CreateIndexBuffer()

IndexBuffer * Graphics::RendererOGL::CreateIndexBuffer ( Uint32  size,
BufferUsage  usage 
)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ CreateInstanceBuffer()

InstanceBuffer * Graphics::RendererOGL::CreateInstanceBuffer ( Uint32  size,
BufferUsage  usage 
)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ CreateMaterial()

Material * Graphics::RendererOGL::CreateMaterial ( const MaterialDescriptor descriptor)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ CreateRenderState()

RenderState * Graphics::RendererOGL::CreateRenderState ( const RenderStateDesc desc)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ CreateRenderTarget()

RenderTarget * Graphics::RendererOGL::CreateRenderTarget ( const RenderTargetDesc desc)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ CreateTexture()

Texture * Graphics::RendererOGL::CreateTexture ( const TextureDescriptor descriptor)
finaloverridevirtual

Implements Graphics::Renderer.

◆ CreateVertexBuffer()

VertexBuffer * Graphics::RendererOGL::CreateVertexBuffer ( const VertexBufferDesc desc)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ DrawBuffer()

bool Graphics::RendererOGL::DrawBuffer ( VertexBuffer vb,
RenderState state,
Material mat,
PrimitiveType  pt 
)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ DrawBufferIndexed()

bool Graphics::RendererOGL::DrawBufferIndexed ( VertexBuffer vb,
IndexBuffer ib,
RenderState state,
Material mat,
PrimitiveType  pt 
)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ DrawBufferIndexedInstanced()

bool Graphics::RendererOGL::DrawBufferIndexedInstanced ( VertexBuffer vb,
IndexBuffer ib,
RenderState state,
Material mat,
InstanceBuffer instb,
PrimitiveType  pt = TRIANGLES 
)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ DrawBufferInstanced()

bool Graphics::RendererOGL::DrawBufferInstanced ( VertexBuffer vb,
RenderState state,
Material mat,
InstanceBuffer instb,
PrimitiveType  type = TRIANGLES 
)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ DrawPointSprites() [1/2]

bool Graphics::RendererOGL::DrawPointSprites ( const Uint32  count,
const vector3f positions,
const vector2f offsets,
const float *  sizes,
RenderState rs,
Material material 
)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ DrawPointSprites() [2/2]

bool Graphics::RendererOGL::DrawPointSprites ( const Uint32  count,
const vector3f positions,
RenderState rs,
Material material,
float  size 
)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ DrawTriangles()

bool Graphics::RendererOGL::DrawTriangles ( const VertexArray vertices,
RenderState state,
Material material,
PrimitiveType  type = TRIANGLES 
)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ EndFrame()

bool Graphics::RendererOGL::EndFrame ( )
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ FrameGrab()

bool Graphics::RendererOGL::FrameGrab ( ScreendumpState sd)
finaloverridevirtual

Reimplemented from Graphics::Renderer.

◆ GetCurrentTransform()

matrix4x4f& Graphics::RendererOGL::GetCurrentTransform ( )
inlineprotected

◆ GetMaximumNumberAASamples()

int Graphics::RendererOGL::GetMaximumNumberAASamples ( ) const
finaloverridevirtual

Implements Graphics::Renderer.

◆ GetName()

virtual const char* Graphics::RendererOGL::GetName ( ) const
inlinefinaloverridevirtual

Implements Graphics::Renderer.

◆ GetNearFarRange()

bool Graphics::RendererOGL::GetNearFarRange ( float &  near_,
float &  far_ 
) const
finaloverridevirtual

Implements Graphics::Renderer.

◆ GetNumLights()

virtual Uint32 Graphics::RendererOGL::GetNumLights ( ) const
inlinefinaloverridevirtual

Reimplemented from Graphics::Renderer.

◆ GetOrCreateProgram()

OGL::Program * Graphics::RendererOGL::GetOrCreateProgram ( OGL::Material mat)
protected
Here is the call graph for this function:

◆ GetProjection()

matrix4x4f Graphics::RendererOGL::GetProjection ( ) const
finaloverridevirtual

Implements Graphics::Renderer.

◆ GetRendererType()

virtual RendererType Graphics::RendererOGL::GetRendererType ( ) const
inlinefinaloverridevirtual

Implements Graphics::Renderer.

◆ GetTransform()

matrix4x4f Graphics::RendererOGL::GetTransform ( ) const
finaloverridevirtual

Implements Graphics::Renderer.

◆ GetViewport()

Viewport Graphics::RendererOGL::GetViewport ( ) const
finaloverridevirtual

Implements Graphics::Renderer.

◆ PopState()

void Graphics::RendererOGL::PopState ( )
finaloverrideprotectedvirtual

Implements Graphics::Renderer.

◆ PushState()

void Graphics::RendererOGL::PushState ( )
finaloverrideprotectedvirtual

Implements Graphics::Renderer.

◆ RegisterRenderer()

void Graphics::RendererOGL::RegisterRenderer ( )
static
Here is the call graph for this function:

◆ ReloadShaders()

bool Graphics::RendererOGL::ReloadShaders ( )
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ ResetDepthRange()

bool Graphics::RendererOGL::ResetDepthRange ( )
finaloverridevirtual

Implements Graphics::Renderer.

◆ Screendump()

bool Graphics::RendererOGL::Screendump ( ScreendumpState sd)
finaloverridevirtual

Reimplemented from Graphics::Renderer.

◆ SetAmbientColor()

bool Graphics::RendererOGL::SetAmbientColor ( const Color c)
finaloverridevirtual

Implements Graphics::Renderer.

◆ SetClearColor()

bool Graphics::RendererOGL::SetClearColor ( const Color c)
finaloverridevirtual

Implements Graphics::Renderer.

◆ SetDepthRange()

bool Graphics::RendererOGL::SetDepthRange ( double  znear,
double  zfar 
)
finaloverridevirtual

Implements Graphics::Renderer.

◆ SetLights()

bool Graphics::RendererOGL::SetLights ( Uint32  numlights,
const Light l 
)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ SetMaterialShaderTransforms()

void Graphics::RendererOGL::SetMaterialShaderTransforms ( Material m)
protected
Here is the call graph for this function:

◆ SetOrthographicProjection()

bool Graphics::RendererOGL::SetOrthographicProjection ( float  xmin,
float  xmax,
float  ymin,
float  ymax,
float  zmin,
float  zmax 
)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ SetPerspectiveProjection()

bool Graphics::RendererOGL::SetPerspectiveProjection ( float  fov,
float  aspect,
float  near_,
float  far_ 
)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ SetProjection()

bool Graphics::RendererOGL::SetProjection ( const matrix4x4f m)
finaloverridevirtual

Implements Graphics::Renderer.

◆ SetRenderState()

bool Graphics::RendererOGL::SetRenderState ( RenderState rs)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ SetRenderTarget()

bool Graphics::RendererOGL::SetRenderTarget ( RenderTarget rt)
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ SetScissor()

bool Graphics::RendererOGL::SetScissor ( bool  enabled,
const vector2f pos = vector2f(0.0f),
const vector2f size = vector2f(0.0f) 
)
finaloverridevirtual

Implements Graphics::Renderer.

◆ SetTransform()

bool Graphics::RendererOGL::SetTransform ( const matrix4x4f m)
finaloverridevirtual

Implements Graphics::Renderer.

◆ SetViewport()

bool Graphics::RendererOGL::SetViewport ( Viewport  v)
finaloverridevirtual

Implements Graphics::Renderer.

◆ SetWireFrameMode()

bool Graphics::RendererOGL::SetWireFrameMode ( bool  enabled)
finaloverridevirtual

Implements Graphics::Renderer.

◆ SupportsInstancing()

virtual bool Graphics::RendererOGL::SupportsInstancing ( )
inlinefinaloverridevirtual

Implements Graphics::Renderer.

◆ SwapBuffers()

bool Graphics::RendererOGL::SwapBuffers ( )
finaloverridevirtual

Implements Graphics::Renderer.

Here is the call graph for this function:

◆ WriteRendererInfo()

void Graphics::RendererOGL::WriteRendererInfo ( std::ostream &  out) const
finaloverridevirtual

Reimplemented from Graphics::Renderer.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ OGL::BillboardMaterial

friend class OGL::BillboardMaterial
friend

◆ OGL::FresnelColourMaterial

friend class OGL::FresnelColourMaterial
friend

◆ OGL::GasGiantSurfaceMaterial

friend class OGL::GasGiantSurfaceMaterial
friend

◆ OGL::GenGasGiantColourMaterial

friend class OGL::GenGasGiantColourMaterial
friend

◆ OGL::GeoSphereSkyMaterial

friend class OGL::GeoSphereSkyMaterial
friend

◆ OGL::GeoSphereStarMaterial

friend class OGL::GeoSphereStarMaterial
friend

◆ OGL::GeoSphereSurfaceMaterial

friend class OGL::GeoSphereSurfaceMaterial
friend

◆ OGL::LitMultiMaterial

friend class OGL::LitMultiMaterial
friend

◆ OGL::Material

friend class OGL::Material
friend

◆ OGL::MultiMaterial

friend class OGL::MultiMaterial
friend

◆ OGL::RingMaterial

friend class OGL::RingMaterial
friend

◆ OGL::ShieldMaterial

friend class OGL::ShieldMaterial
friend

Member Data Documentation

◆ m_activeRenderState

RenderState* Graphics::RendererOGL::m_activeRenderState = nullptr
protected

◆ m_activeRenderTarget

OGL::RenderTarget* Graphics::RendererOGL::m_activeRenderTarget = nullptr
protected

◆ m_currentTransform

matrix4x4f Graphics::RendererOGL::m_currentTransform
protected

◆ m_invLogZfarPlus1

float Graphics::RendererOGL::m_invLogZfarPlus1
protected

◆ m_maxZFar

float Graphics::RendererOGL::m_maxZFar
protected

◆ m_minZNear

float Graphics::RendererOGL::m_minZNear
protected

◆ m_modelViewMat

matrix4x4f Graphics::RendererOGL::m_modelViewMat
protected

◆ m_numDirLights

Uint32 Graphics::RendererOGL::m_numDirLights
protected

◆ m_numLights

Uint32 Graphics::RendererOGL::m_numLights
protected

◆ m_programs

std::vector<std::pair<MaterialDescriptor, OGL::Program *> > Graphics::RendererOGL::m_programs
protected

◆ m_projectionMat

matrix4x4f Graphics::RendererOGL::m_projectionMat
protected

◆ m_renderStates

std::unordered_map<Uint32, OGL::RenderState *> Graphics::RendererOGL::m_renderStates
protected

◆ m_useAnisotropicFiltering

bool Graphics::RendererOGL::m_useAnisotropicFiltering
protected

◆ m_useCompressedTextures

bool Graphics::RendererOGL::m_useCompressedTextures
protected

◆ m_useNVDepthRanged

bool Graphics::RendererOGL::m_useNVDepthRanged
protected

◆ m_vertexAttribsSet

std::vector<GLuint> Graphics::RendererOGL::m_vertexAttribsSet
protected

◆ m_viewport

Viewport Graphics::RendererOGL::m_viewport
protected

◆ m_windowRenderTarget

OGL::RenderTarget* Graphics::RendererOGL::m_windowRenderTarget = nullptr
protected

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