This class provides an interface to a renderer. More...
#include "Renderer.hpp"
Public Types | |
enum | RenderActionT { AMBIENT, STENCILSHADOW, LIGHTING } |
enum | MatrixNameT { MODEL_TO_WORLD, WORLD_TO_VIEW, PROJECTION, END_MARKER } |
enum | PickingRenderModeT { RENDER, SELECT, FEEDBACK } |
Public Member Functions | |
virtual bool | IsSupported () const =0 |
Returns true if this renderer is supported on this system (e.g. More... | |
virtual bool | DoesSupportCompressedSHL () const =0 |
Returns true if this renderer supports SHL rendering with compressed (indexed) SHLMaps, false otherwise. More... | |
virtual bool | DoesSupportUncompressedSHL () const =0 |
Returns true if this renderer supports SHL rendering with uncompressed SHLMaps (four coefficients per SHLMap), false otherwise. More... | |
virtual int | GetPreferenceNr () const =0 |
Returns a "global" preference number for this renderer. More... | |
virtual void | Initialize ()=0 |
Call this after a successful call to IsSupported() in order to prepare the renderer for use. More... | |
virtual void | Release ()=0 |
Call this in order to release this renderer. More... | |
virtual const char * | GetDescription () const =0 |
Returns a description of this renderer, e.g. More... | |
virtual MatSys::RenderMaterialT * | RegisterMaterial (const MaterialT *Material) const =0 |
Registers the Material with the renderer, and returns a handle for future reference. More... | |
virtual const MaterialT * | GetMaterialFromRM (MatSys::RenderMaterialT *RenderMaterial) const =0 |
Returns the MaterialT object that was used in RegisterMaterial() to create the RenderMaterial. More... | |
virtual unsigned long | GetAmbientShaderIDFromRM (MatSys::RenderMaterialT *RenderMaterial) const =0 |
Returns the ID of the ambient shader of the RenderMaterial. More... | |
virtual unsigned long | GetLightShaderIDFromRM (MatSys::RenderMaterialT *RenderMaterial) const =0 |
Returns the ID of the light shader of the RenderMaterial. More... | |
virtual void | FreeMaterial (MatSys::RenderMaterialT *RenderMaterial)=0 |
Used to free the previously registered (render-)material. More... | |
virtual void | BeginFrame (double Time)=0 |
Call this to begin rendering a new frame. More... | |
virtual void | EndFrame ()=0 |
Call this to end the current frame. More... | |
virtual void | PreCache ()=0 |
This function pre-caches all textures of all materials that have been registered with RegisterMaterial() so far. More... | |
virtual void | SetCurrentRenderAction (RenderActionT RA)=0 |
This activates a specific render action, as is required for multi-pass rendering with dynamic lights and stencil shadows. More... | |
virtual RenderActionT | GetCurrentRenderAction () const =0 |
Returns the currently set render action. More... | |
virtual void | SetGenPurposeRenderingParam (unsigned long Index, float Value)=0 |
virtual void | SetGenPurposeRenderingParam (unsigned long Index, int Value)=0 |
virtual float | GetGenPurposeRenderingParamF (unsigned long Index) const =0 |
virtual int | GetGenPurposeRenderingParamI (unsigned long Index) const =0 |
virtual void | SetCurrentAmbientLightColor (float r, float g, float b)=0 |
virtual float * | GetCurrentAmbientLightColor ()=0 |
virtual const float * | GetCurrentAmbientLightColor () const =0 |
virtual void | SetCurrentLightSourcePosition (float x, float y, float z)=0 |
virtual float * | GetCurrentLightSourcePosition ()=0 |
virtual const float * | GetCurrentLightSourcePosition () const =0 |
virtual void | SetCurrentLightSourceRadius (float r)=0 |
virtual float & | GetCurrentLightSourceRadius ()=0 |
virtual const float & | GetCurrentLightSourceRadius () const =0 |
virtual void | SetCurrentLightSourceDiffuseColor (float r, float g, float b)=0 |
virtual float * | GetCurrentLightSourceDiffuseColor ()=0 |
virtual const float * | GetCurrentLightSourceDiffuseColor () const =0 |
virtual void | SetCurrentLightSourceSpecularColor (float r, float g, float b)=0 |
virtual float * | GetCurrentLightSourceSpecularColor ()=0 |
virtual const float * | GetCurrentLightSourceSpecularColor () const =0 |
virtual void | SetCurrentEyePosition (float x, float y, float z)=0 |
virtual float * | GetCurrentEyePosition ()=0 |
virtual const float * | GetCurrentEyePosition () const =0 |
virtual void | PushLightingParameters ()=0 |
Pushes all lighting parameters onto a stack. More... | |
virtual void | PopLightingParameters ()=0 |
Pops (restores) the lighting parameters that have previously been pushed onto the stack. More... | |
virtual void | ClearColor (float r, float g, float b, float a)=0 |
virtual void | Flush ()=0 |
virtual const Matrix4x4fT & | GetMatrix (MatrixNameT MN) const =0 |
virtual const Matrix4x4fT & | GetMatrixInv (MatrixNameT MN) const =0 |
virtual const Matrix4x4fT & | GetMatrixModelView () const =0 |
virtual void | SetMatrix (MatrixNameT MN, const Matrix4x4fT &Matrix)=0 |
virtual void | Translate (MatrixNameT MN, float x, float y, float z)=0 |
virtual void | Scale (MatrixNameT MN, float scale)=0 |
virtual void | RotateX (MatrixNameT MN, float angle)=0 |
virtual void | RotateY (MatrixNameT MN, float angle)=0 |
virtual void | RotateZ (MatrixNameT MN, float angle)=0 |
virtual void | PushMatrix (MatrixNameT MN)=0 |
virtual void | PopMatrix (MatrixNameT MN)=0 |
virtual void | SetViewport (int x, int y, int width, int height)=0 |
virtual void | GetViewport (int viewport[4])=0 |
virtual void | SetSelectionBuffer (unsigned long Size, unsigned int *Buffer)=0 |
virtual unsigned long | SetPickingRenderMode (PickingRenderModeT PRM)=0 |
virtual void | InitNameStack ()=0 |
virtual void | LoadName (unsigned long Name)=0 |
virtual void | PushName (unsigned long Name)=0 |
virtual void | PopName ()=0 |
virtual void | SetCurrentMaterial (MatSys::RenderMaterialT *RenderMaterial)=0 |
virtual MatSys::RenderMaterialT * | GetCurrentMaterial () const =0 |
virtual void | LockCurrentMaterial (bool LockCM_)=0 |
virtual void | SetCurrentLightMap (TextureMapI *LightMap)=0 |
virtual void | SetCurrentLightDirMap (TextureMapI *LightDirMap)=0 |
virtual void | SetCurrentSHLMaps (const ArrayT< TextureMapI * > &SHLMaps)=0 |
virtual void | SetCurrentSHLLookupMap (TextureMapI *SHLLookupMap)=0 |
virtual void | RenderMesh (const MatSys::MeshT &Mesh)=0 |
virtual | ~RendererI () |
This ABC does neither have nor need a destructor, because no implementation will ever be deleted via a pointer to a RendererI. More... | |
This class provides an interface to a renderer.
The interface is specified as ABC in order to share the renderer across exe/dll boundaries.
|
inlinevirtual |
This ABC does neither have nor need a destructor, because no implementation will ever be deleted via a pointer to a RendererI.
(The implementations are singletons after all.) See the Singleton pattern and the C++ FAQ 21.05 (the "precise rule") for more information. g++ however issues a warning with no such destructor, so I provide one anyway and am safe.
|
pure virtual |
Call this to begin rendering a new frame.
This function typically clears the screen and calls other implementation specific functions to start a new frame. Time is the global time in seconds at which this frame starts.
Implemented in RendererImplT.
|
pure virtual |
Returns true if this renderer supports SHL rendering with compressed (indexed) SHLMaps, false otherwise.
Implemented in RendererImplT.
|
pure virtual |
Returns true if this renderer supports SHL rendering with uncompressed SHLMaps (four coefficients per SHLMap), false otherwise.
Implemented in RendererImplT.
|
pure virtual |
Call this to end the current frame.
This function typically calls functions like SwapBuffers() and other implementation specific functions to end a frame.
Implemented in RendererImplT.
|
pure virtual |
Used to free the previously registered (render-)material.
If RenderMaterial happens to be the currently used material, SetCurrentMaterial(NULL) is automatically called before RenderMaterial is deleted.
Implemented in RendererImplT.
|
pure virtual |
Returns the ID of the ambient shader of the RenderMaterial.
This number can be used by the calling code in order to adjust the draw order (for the AMBIENT render action). It is guaranteed that the returned value is reasonably small, that is, not greater than the number of shaders that are employed in this renderer.
Implemented in RendererImplT.
|
pure virtual |
Returns the currently set render action.
Implemented in RendererImplT.
|
pure virtual |
Returns a description of this renderer, e.g.
for informing the users about the underlying technique (OpenGL, DirectX, ...), the capabilities, or details about the implementation.
Implemented in RendererImplT.
|
pure virtual |
Returns the ID of the light shader of the RenderMaterial.
This number can be used by the calling code in order to adjust the draw order (for the LIGHTING render action). It is guaranteed that the returned value is reasonably small, that is, not greater than the number of shaders that are employed in this renderer.
Implemented in RendererImplT.
|
pure virtual |
Returns the MaterialT object that was used in RegisterMaterial() to create the RenderMaterial.
Implemented in RendererImplT.
|
pure virtual |
Returns a "global" preference number for this renderer.
This helps the caller code the select the "best" or "most preferred" renderer among many.
Implemented in RendererImplT.
|
pure virtual |
Call this after a successful call to IsSupported() in order to prepare the renderer for use.
Implemented in RendererImplT.
|
pure virtual |
Returns true if this renderer is supported on this system (e.g.
required OpenGL extensions are present, version of DirectX matches, ...), and returns false otherwise. This function must not be called before the underlying video environment (i.e. the OpenGL rendering context) has been initialized. No preceeding call to Initialize() is required, and the environment is left as clean as it was found, such that no subsequent actions (i.e. calls to this function of other renderers) get into trouble.
Implemented in RendererImplT.
|
pure virtual |
Pops (restores) the lighting parameters that have previously been pushed onto the stack.
Nothing happens if the stack is empty.
Implemented in RendererImplT.
|
pure virtual |
This function pre-caches all textures of all materials that have been registered with RegisterMaterial() so far.
As a result, the delay that otherwise occurs when new textures are first used for rendering is minimized.
Implemented in RendererImplT.
|
pure virtual |
Pushes all lighting parameters onto a stack.
The depth of the stack is only limited by available memory. The following parameters are covered: Light source position and radius, light source diffuse and specular color, and the eye position. The ambient light color is currently NOT covered.
Implemented in RendererImplT.
|
pure virtual |
Registers the Material with the renderer, and returns a handle for future reference.
NULL can be passed for Material, in which case a "null" handle will be returned, which is nonetheless valid (but just won't cause any rendering output later).
Implemented in RendererImplT.
|
pure virtual |
Call this in order to release this renderer.
Implemented in RendererImplT.
|
pure virtual |
This activates a specific render action, as is required for multi-pass rendering with dynamic lights and stencil shadows.
Rendering geometry will only consider those parts of the materials that are relevant for their currently set action.
Implemented in RendererImplT.