11 #ifndef CAFU_MATSYS_RENDERER_IMPLEMENTATION_HPP_INCLUDED
12 #define CAFU_MATSYS_RENDERER_IMPLEMENTATION_HPP_INCLUDED
16 #undef WIN32 // VC++ 8 seems to predefine something here that is not an integer, and thus doesn't work with the "#if WIN32" expression in cgGL.h.
22 #include "../Renderer.hpp"
23 #include "Templates/Array.hpp"
24 #include "Math3D/Matrix.hpp"
25 #include "../Common/DepRelMatrix.hpp"
26 #include "../Expression.hpp"
59 void SetGenPurposeRenderingParam (
unsigned long Index,
float Value);
60 void SetGenPurposeRenderingParam (
unsigned long Index,
int Value);
61 float GetGenPurposeRenderingParamF(
unsigned long Index)
const;
62 int GetGenPurposeRenderingParamI(
unsigned long Index)
const;
64 void SetCurrentAmbientLightColor(
float r,
float g,
float b);
65 float* GetCurrentAmbientLightColor();
66 const float* GetCurrentAmbientLightColor()
const;
68 void SetCurrentLightSourcePosition(
float x,
float y,
float z);
69 float* GetCurrentLightSourcePosition();
70 const float* GetCurrentLightSourcePosition()
const;
71 void SetCurrentLightSourceRadius(
float r);
72 float& GetCurrentLightSourceRadius();
73 const float& GetCurrentLightSourceRadius()
const;
74 void SetCurrentLightSourceDiffuseColor (
float r,
float g,
float b);
75 float* GetCurrentLightSourceDiffuseColor();
76 const float* GetCurrentLightSourceDiffuseColor()
const;
77 void SetCurrentLightSourceSpecularColor(
float r,
float g,
float b);
78 float* GetCurrentLightSourceSpecularColor();
79 const float* GetCurrentLightSourceSpecularColor()
const;
81 void SetCurrentEyePosition(
float x,
float y,
float z);
82 float* GetCurrentEyePosition();
83 const float* GetCurrentEyePosition()
const;
88 void ClearColor(
float r,
float g,
float b,
float a);
91 const MatrixT& GetMatrix(MatrixNameT MN)
const;
92 const MatrixT& GetMatrixInv(MatrixNameT MN)
const;
93 const MatrixT& GetMatrixModelView()
const;
95 void SetMatrix(MatrixNameT MN,
const MatrixT& Matrix);
96 void Translate(MatrixNameT MN,
float x,
float y,
float z);
97 void Scale (MatrixNameT MN,
float scale);
98 void RotateX (MatrixNameT MN,
float angle);
99 void RotateY (MatrixNameT MN,
float angle);
100 void RotateZ (MatrixNameT MN,
float angle);
102 void PushMatrix(MatrixNameT MN);
103 void PopMatrix (MatrixNameT MN);
105 void SetViewport(
int x,
int y,
int width,
int height);
106 void GetViewport(
int viewport[4]);
108 void SetSelectionBuffer(
unsigned long Size,
unsigned int* Buffer);
109 unsigned long SetPickingRenderMode(PickingRenderModeT PRM);
110 void InitNameStack();
111 void LoadName(
unsigned long Name);
112 void PushName(
unsigned long Name);
117 void LockCurrentMaterial(
bool LockCM);
135 unsigned long GetInitCounter()
const;
136 CGcontext GetCgContext()
const;
139 const DepRelMatrixT& GetDepRelMatrixInv(MatrixNameT MN)
const;
149 struct LightingParamsT
151 float LightSourcePosition[3];
152 float LightSourceRadius;
153 float LightSourceDiffuseColor[3];
154 float LightSourceSpecularColor[3];
155 float EyePosition[3];
160 void SetCurrentShader();
163 RenderActionT CurrentRenderAction;
171 LightingParamsT CurrentLightingParams;
178 unsigned long InitCounter;
179 unsigned long ShaderChangeCounter;
202 #if defined(_WIN32) && defined(_MSC_VER)
unsigned long GetAmbientShaderIDFromRM(MatSys::RenderMaterialT *RenderMaterial) const
Returns the ID of the ambient shader of the RenderMaterial.
Definition: RendererImpl.cpp:377
void BeginFrame(double Time)
Call this to begin rendering a new frame.
Definition: RendererImpl.cpp:416
const MaterialT * GetMaterialFromRM(MatSys::RenderMaterialT *RenderMaterial) const
Returns the MaterialT object that was used in RegisterMaterial() to create the RenderMaterial.
Definition: RendererImpl.cpp:369
This class represents a surface render material.
Definition: RenderMaterial.hpp:25
This class models the relationship with which a product matrix A*B depends on its components A and B ...
Definition: DepRelMatrix.hpp:76
void Initialize()
Call this after a successful call to IsSupported() in order to prepare the renderer for use...
Definition: RendererImpl.cpp:251
bool DoesSupportCompressedSHL() const
Returns true if this renderer supports SHL rendering with compressed (indexed) SHLMaps, false otherwise.
Definition: RendererImpl.cpp:125
int GetPreferenceNr() const
Returns a "global" preference number for this renderer.
Definition: RendererImpl.cpp:137
void FreeMaterial(MatSys::RenderMaterialT *RenderMaterial)
Used to free the previously registered (render-)material.
Definition: RendererImpl.cpp:401
void SetCurrentRenderAction(RenderActionT RA)
This activates a specific render action, as is required for multi-pass rendering with dynamic lights ...
Definition: RendererImpl.cpp:528
void PreCache()
This function pre-caches all textures of all materials that have been registered with RegisterMateria...
Definition: RendererImpl.cpp:454
bool IsSupported() const
Returns true if this renderer is supported on this system (e.g.
Definition: RendererImpl.cpp:85
const char * GetDescription() const
Returns a description of this renderer, e.g.
Definition: RendererImpl.cpp:314
This class represents a generic 4x4 matrix.
Definition: MapElement.hpp:30
This class represents a surface material ("A datastructural representation of a scripts material def...
Definition: Material.hpp:22
This is an interface to a texture-map.
Definition: TextureMap.hpp:23
This class models the relationship with which a inverse matrix depends on its original matrix...
Definition: DepRelMatrix.hpp:51
void PopLightingParameters()
Pops (restores) the lighting parameters that have previously been pushed onto the stack...
Definition: RendererImpl.cpp:704
void PushLightingParameters()
Pushes all lighting parameters onto a stack.
Definition: RendererImpl.cpp:698
This class represents a shader.
Definition: Shader.hpp:28
A matrix class with which dependencies among matrices can be handled.
Definition: DepRelMatrix.hpp:22
bool DoesSupportUncompressedSHL() const
Returns true if this renderer supports SHL rendering with uncompressed SHLMaps (four coefficients per...
Definition: RendererImpl.cpp:131
unsigned long GetLightShaderIDFromRM(MatSys::RenderMaterialT *RenderMaterial) const
Returns the ID of the light shader of the RenderMaterial.
Definition: RendererImpl.cpp:389
void EndFrame()
Call this to end the current frame.
Definition: RendererImpl.cpp:445
This structure contains the values for the "variables" of an expression.
Definition: Expression.hpp:69
This class represents a cube texture-map.
Definition: TextureMapImpl.hpp:92
MatSys::RenderMaterialT * RegisterMaterial(const MaterialT *Material) const
Registers the Material with the renderer, and returns a handle for future reference.
Definition: RendererImpl.cpp:332
This class represents a 2D texture-map.
Definition: TextureMapImpl.hpp:46
Definition: RendererImpl.hpp:34
This class provides an interface to a renderer.
Definition: Renderer.hpp:31
RenderActionT GetCurrentRenderAction() const
Returns the currently set render action.
Definition: RendererImpl.cpp:542
This class represents a polygonal mesh.
Definition: Mesh.hpp:45
void Release()
Call this in order to release this renderer.
Definition: RendererImpl.cpp:294