Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

renderer
Class CRenderer

IJSObject
   |
   +--CJSObject, SceneCollector, Singleton
         |
         +--CRenderer

   in Renderer.h
   in Renderer.cpp

class CRenderer
extends CJSObject, SceneCollector, Singleton


Inner Classes, Typedefs, and Enums
enum CRenderer::anonymous_enum_1
          
enum CRenderer::anonymous_enum_2
          
struct CRenderer::anonymous_struct_1
          
struct CRenderer::Caps
          
enum CRenderer::Option
          
struct CRenderer::Options
          
enum CRenderer::RenderPath
          
struct CRenderer::Stats
          
 
Field Summary
protected CRendererInternals* m
          
protected GLuint[ MaxTextureUnits ] m_ActiveTextures
          
protected CRenderer::anonymous_struct_1[ NumAlphaMaps ] m_AlphaMapCoords
          
protected CRenderer::Caps m_Caps
          
protected float[ 4 ] m_ClearColor
          
protected CCamera m_CullCamera
          m_CullCamera: determines the frustum for culling and shadowmap calculations
protected int m_Depth
          
protected bool m_DisableCopyShadow
          m_DisableCopyShadow: For debugging purpose: Disable copying of shadow data into the shadow texture (when EXT_fbo is not available)
protected bool m_DisplayFrustum
          m_DisplayFrustum: Render the cull frustum and other data that may be interesting to evaluate culling and shadow map calculations Can be controlled from JS via renderer.
protected bool m_FastPlayerColor
          
protected int m_FrameCounter
          
protected Handle m_hCompositeAlphaMap
          
protected int m_Height
          
protected CLightEnv* m_LightEnv
          
protected ERenderMode m_ModelRenderMode
          
 CRenderer::Options m_Options
          
 bool m_RenderTerritories
          m_RenderTerritories: Turn territory boundary rendering on or off.
 int m_ShadowMapSize
          m_ShadowMapSize: Size of shadow map, or 0 for default.
 float m_ShadowZBias
          m_ShadowZBias: Z bias used when rendering shadows into a depth texture.
 bool m_SkipSubmit
          m_SkipSubmit: Disable the actual submission of rendering commands to OpenGL.
protected SkyManager* m_SkyManager
          m_SkyManager: the SkyManager object used for sky textures and settings
protected bool m_SortAllTransparent
          m_SortAllTransparent: If true, all transparent models are rendered using the TransparencyRenderer which performs sorting.
protected CRenderer::Stats m_Stats
          
protected ERenderMode m_TerrainRenderMode
          
protected RenderPathVertexShader* m_VertexShader
          If false, use a multipass fallback for player colors.
protected CCamera m_ViewCamera
          m_ViewCamera: determines the eye position for rendering
protected WaterManager* m_WaterManager
          m_WaterManager: the WaterManager object used for water textures and settings (e.g. water color, water height)
protected int m_Width
          
   
Fields inherited from class CJSObject
m_NativeProperties, m_NonsharedProperties, m_ScriptProperties, m_EngineOwned, JSI_class
 
Constructor Summary
CRenderer()
          CRenderer destructor
~CRenderer()
          EnumCaps: build card cap bits
 
Method Summary
 void BeginFrame()
          SetClearColor: set color used to clear screen in BeginFrame()
 void BindTexture( int unit, GLuint tex )
          SetTexture: set the given unit to reference the given texture; pass a null texture to disable texturing on any unit
protected void DisplayFrustum()
          SetSceneCamera: setup projection and transform of camera and adjust viewport to current view The camera always represents the actual camera used to render a scene, not any virtual camera used for shadow rendering or reflections.
 void EndFrame()
          DisplayFrustum: debug displays - white: cull camera frustum - red: bounds of shadow casting objects
protected void EnumCaps()
          
 float GetAspect() const
          
 const CRenderer::Caps& GetCapabilities() const
          GetCapabilities: Return which OpenGL capabilities are available and enabled.
 const CCamera& GetCullCamera() const
          
 bool GetDisableCopyShadow() const
          
 int GetFrameCounter() const
          
 int GetHeight() const
          
 const CLightEnv& GetLightEnv()
          
 ERenderMode GetModelRenderMode() const
          
 CMatrix3D GetModelViewProjectionMatrix()
          SetObliqueFrustumClipping: change the near plane to the given clip plane (in world space) Based on code from Game Programming Gems 5, from http://www.
 bool GetOptionBool( enum CRenderer::Option opt ) const
          SetOptionColor: set color renderer option void CRenderer::SetOptionColor(Option UNUSED(opt),const RGBAColor& UNUSED(value)) { // switch (opt) { // default: debug_warn("CRenderer::SetOptionColor: unknown option"); // break; // } }
 CRenderer::RenderPath GetRenderPath() const
          
 CRenderer::RenderPath GetRenderPathByName( const CStr& name )
          SetFastPlayerColor
 static CStr GetRenderPathName( CRenderer::RenderPath rp )
          
 SkyManager* GetSkyManager()
          GetSkyManager: Return the renderer's sky manager.
 const CRenderer::Stats& GetStats()
          
 ERenderMode GetTerrainRenderMode() const
          
 const CCamera& GetViewCamera() const
          
 WaterManager* GetWaterManager()
          GetWaterManager: Return the renderer's water manager.
 int GetWidth() const
          
 bool IsTextureTransparent( CTexture* texture )
          
protected jsval JSI_GetDepthTextureBits( JSContext* )
          
protected jsval JSI_GetFastPlayerColor( JSContext* )
          
protected jsval JSI_GetRenderPath( JSContext* )
          
protected jsval JSI_GetSky( JSContext* )
          
protected jsval JSI_GetUseDepthTexture( JSContext* )
          
protected void JSI_SetDepthTextureBits( JSContext* ctx, jsval newval )
          
protected void JSI_SetFastPlayerColor( JSContext* ctx, jsval newval )
          
protected void JSI_SetRenderPath( JSContext* ctx, jsval newval )
          
protected void JSI_SetSky( JSContext* ctx, jsval newval )
          
protected void JSI_SetUseDepthTexture( JSContext* ctx, jsval newval )
          
 int LoadAlphaMaps()
          UnloadAlphaMaps: frees the resources allocates by LoadAlphaMaps
 bool LoadTexture( CTexture* texture, u32 wrapflags )
          BindTexture: bind a GL texture object to current active unit
 bool Open( int width, int height, int depth )
          
protected void RenderModels()
          
protected void RenderPatches()
          
protected void RenderReflections()
          RenderRefractions: render the water refractions to the refraction texture
protected void RenderRefractions()
          RenderSubmissions: force rendering of any batched objects
 void RenderScene( Scene* scene )
          LoadTexture: try and load the given texture; set clamp/repeat flags on texture object if necessary
protected void RenderShadowMap()
          
protected void RenderSubmissions()
          EndFrame: signal frame end
protected void RenderTransparentModels()
          GetModelViewProjectionMatrix: save the current OpenGL model-view-projection matrix
 void Resize( int width, int height )
          SetOptionBool: set boolean renderer option
protected static void ScriptingInit()
          
 void SetClearColor( u32 color )
          
 void SetFastPlayerColor( bool fast )
          BeginFrame: signal frame start
 void SetLightEnv( CLightEnv* lightenv )
          
 void SetModelRenderMode( ERenderMode mode )
          
protected void SetObliqueFrustumClipping( const CVector4D& clipPlane, int sign )
          Private data that is not needed by inline functions
 void SetOptionBool( enum CRenderer::Option opt, bool value )
          GetOptionBool: get boolean renderer option
 void SetOptionFloat( enum CRenderer::Option opt, float val )
          GetOptionColor: get color renderer option const RGBAColor& CRenderer::GetOptionColor(Option UNUSED(opt)) const { static const RGBAColor defaultColor(1.0f,1.0f,1.0f,1.0f); // switch (opt) { // default: debug_warn("CRenderer::GetOptionColor: unknown option"); // break; // } return defaultColor; }
 void SetRenderPath( CRenderer::RenderPath rp )
          
 void SetSceneCamera( const CCamera& viewCamera, const CCamera& cullCamera )
          Set up the camera used for rendering the next scene; this includes setting OpenGL state like viewport, projection and modelview matrices.
 void SetTerrainRenderMode( ERenderMode mode )
          
 void SetTexture( int unit, CTexture* texture )
          IsTextureTransparent: return true if given texture is transparent, else false - note texture must be loaded beforehand
 void SetViewport( const SViewPort& vp )
          
protected void Submit( CPatch* patch )
          
protected void SubmitNonRecursive( CModel* model )
          Render the given scene
 void UnloadAlphaMaps()
          Scripting Interface
   
Methods inherited from class CJSObject
ScriptingInit, ScriptingShutdown, GetProperty, SetProperty, HasProperty, AddProperty, AddProperty, AddProperty, AddMethod, AddProperty, AddLocalProperty, GetScript, CreateScriptObject, ReleaseScriptObject, Shutdown
   
Methods inherited from class SceneCollector
SubmitRecursive, Submit, SubmitNonRecursive
   
Methods inherited from class Singleton
GetSingleton, GetSingletonPtr, IsInitialised
   
Methods inherited from class IJSObject
HasProperty, GetProperty, AddProperty, AddProperty
 

Field Detail

m

protected CRendererInternals* m;

m_ActiveTextures

protected GLuint m_ActiveTextures[ MaxTextureUnits ];

m_AlphaMapCoords

protected CRenderer::anonymous_struct_1 m_AlphaMapCoords[ NumAlphaMaps ];

m_Caps

protected CRenderer::Caps m_Caps;

m_ClearColor

protected float m_ClearColor[ 4 ];

m_CullCamera

protected CCamera m_CullCamera;
m_CullCamera: determines the frustum for culling and shadowmap calculations
See Also:
CGameView::m_ViewCamera

m_Depth

protected int m_Depth;

m_DisableCopyShadow

protected bool m_DisableCopyShadow;
m_DisableCopyShadow: For debugging purpose: Disable copying of shadow data into the shadow texture (when EXT_fbo is not available)

m_DisplayFrustum

protected bool m_DisplayFrustum;
m_DisplayFrustum: Render the cull frustum and other data that may be interesting to evaluate culling and shadow map calculations Can be controlled from JS via renderer.displayFrustum

m_FastPlayerColor

protected bool m_FastPlayerColor;

m_FrameCounter

protected int m_FrameCounter;

m_hCompositeAlphaMap

protected Handle m_hCompositeAlphaMap;

m_Height

protected int m_Height;

m_LightEnv

protected CLightEnv* m_LightEnv;

m_ModelRenderMode

protected ERenderMode m_ModelRenderMode;

m_Options

public CRenderer::Options m_Options;

m_RenderTerritories

public bool m_RenderTerritories;
m_RenderTerritories: Turn territory boundary rendering on or off.

m_ShadowMapSize

public int m_ShadowMapSize;
m_ShadowMapSize: Size of shadow map, or 0 for default. Typically slow but useful for high-quality rendering. Changes don't take effect until the shadow map is regenerated. Can be accessed via JS as renderer.shadowMapSize

m_ShadowZBias

public float m_ShadowZBias;
m_ShadowZBias: Z bias used when rendering shadows into a depth texture. This can be used to control shadowing artifacts. Can be accessed via JS as renderer.shadowZBias ShadowMap uses this for matrix calculation.

m_SkipSubmit

public bool m_SkipSubmit;
m_SkipSubmit: Disable the actual submission of rendering commands to OpenGL. All state setup is still performed as usual. Can be accessed via JS as renderer.skipSubmit

m_SkyManager

protected SkyManager* m_SkyManager;
m_SkyManager: the SkyManager object used for sky textures and settings

m_SortAllTransparent

protected bool m_SortAllTransparent;
m_SortAllTransparent: If true, all transparent models are rendered using the TransparencyRenderer which performs sorting. Otherwise, transparent models are rendered using the faster batching renderer when possible.

m_Stats

protected CRenderer::Stats m_Stats;

m_TerrainRenderMode

protected ERenderMode m_TerrainRenderMode;

m_VertexShader

protected RenderPathVertexShader* m_VertexShader;
If false, use a multipass fallback for player colors.

m_ViewCamera

protected CCamera m_ViewCamera;
m_ViewCamera: determines the eye position for rendering
See Also:
CGameView::m_ViewCamera

m_WaterManager

protected WaterManager* m_WaterManager;
m_WaterManager: the WaterManager object used for water textures and settings (e.g. water color, water height)

m_Width

protected int m_Width;


Constructor Detail

CRenderer

public CRenderer();
CRenderer destructor

~CRenderer

public ~CRenderer();
EnumCaps: build card cap bits


Method Detail

BeginFrame

public void BeginFrame();
SetClearColor: set color used to clear screen in BeginFrame()

BindTexture

public void BindTexture( int unit, GLuint tex );
SetTexture: set the given unit to reference the given texture; pass a null texture to disable texturing on any unit

DisplayFrustum

protected void DisplayFrustum();
SetSceneCamera: setup projection and transform of camera and adjust viewport to current view The camera always represents the actual camera used to render a scene, not any virtual camera used for shadow rendering or reflections.

EndFrame

public void EndFrame();
DisplayFrustum: debug displays - white: cull camera frustum - red: bounds of shadow casting objects

EnumCaps

protected void EnumCaps();

GetAspect

public float GetAspect() const;

GetCapabilities

public const CRenderer::Caps& GetCapabilities() const;
GetCapabilities: Return which OpenGL capabilities are available and enabled.
Returns:
capabilities structure

GetCullCamera

public const CCamera& GetCullCamera() const;

GetDisableCopyShadow

public bool GetDisableCopyShadow() const;

GetFrameCounter

public int GetFrameCounter() const;

GetHeight

public int GetHeight() const;

GetLightEnv

public const CLightEnv& GetLightEnv();

GetModelRenderMode

public ERenderMode GetModelRenderMode() const;

GetModelViewProjectionMatrix

public CMatrix3D GetModelViewProjectionMatrix();
SetObliqueFrustumClipping: change the near plane to the given clip plane (in world space) Based on code from Game Programming Gems 5, from http://www.terathon.com/code/oblique.html - cp is a clip plane in camera space (cp.Dot(v) = 0 for any vector v on the plane) - sign is 1 or -1, to specify the side to clip on

GetOptionBool

public bool GetOptionBool( enum CRenderer::Option opt ) const;
SetOptionColor: set color renderer option void CRenderer::SetOptionColor(Option UNUSED(opt),const RGBAColor& UNUSED(value)) { // switch (opt) { // default: debug_warn("CRenderer::SetOptionColor: unknown option"); // break; // } }

GetRenderPath

public CRenderer::RenderPath GetRenderPath() const;

GetRenderPathByName

public CRenderer::RenderPath GetRenderPathByName( const CStr& name );
SetFastPlayerColor

GetRenderPathName

public static CStr GetRenderPathName( CRenderer::RenderPath rp );

GetSkyManager

public SkyManager* GetSkyManager();
GetSkyManager: Return the renderer's sky manager.
Returns:
the SkyManager object used by the renderer

GetStats

public const CRenderer::Stats& GetStats();

GetTerrainRenderMode

public ERenderMode GetTerrainRenderMode() const;

GetViewCamera

public const CCamera& GetViewCamera() const;

GetWaterManager

public WaterManager* GetWaterManager();
GetWaterManager: Return the renderer's water manager.
Returns:
the WaterManager object used by the renderer

GetWidth

public int GetWidth() const;

IsTextureTransparent

public bool IsTextureTransparent( CTexture* texture );

JSI_GetDepthTextureBits

protected jsval JSI_GetDepthTextureBits( JSContext* );

JSI_GetFastPlayerColor

protected jsval JSI_GetFastPlayerColor( JSContext* );

JSI_GetRenderPath

protected jsval JSI_GetRenderPath( JSContext* );

JSI_GetSky

protected jsval JSI_GetSky( JSContext* );

JSI_GetUseDepthTexture

protected jsval JSI_GetUseDepthTexture( JSContext* );

JSI_SetDepthTextureBits

protected void JSI_SetDepthTextureBits( JSContext* ctx, jsval newval );

JSI_SetFastPlayerColor

protected void JSI_SetFastPlayerColor( JSContext* ctx, jsval newval );

JSI_SetRenderPath

protected void JSI_SetRenderPath( JSContext* ctx, jsval newval );

JSI_SetSky

protected void JSI_SetSky( JSContext* ctx, jsval newval );

JSI_SetUseDepthTexture

protected void JSI_SetUseDepthTexture( JSContext* ctx, jsval newval );

LoadAlphaMaps

public int LoadAlphaMaps();
UnloadAlphaMaps: frees the resources allocates by LoadAlphaMaps

LoadTexture

public bool LoadTexture( CTexture* texture, u32 wrapflags );
BindTexture: bind a GL texture object to current active unit

Open

public bool Open( int width, int height, int depth );

RenderModels

protected void RenderModels();

RenderPatches

protected void RenderPatches();

RenderReflections

protected void RenderReflections();
RenderRefractions: render the water refractions to the refraction texture

RenderRefractions

protected void RenderRefractions();
RenderSubmissions: force rendering of any batched objects

RenderScene

public void RenderScene( Scene* scene );
LoadTexture: try and load the given texture; set clamp/repeat flags on texture object if necessary

RenderShadowMap

protected void RenderShadowMap();

RenderSubmissions

protected void RenderSubmissions();
EndFrame: signal frame end

RenderTransparentModels

protected void RenderTransparentModels();
GetModelViewProjectionMatrix: save the current OpenGL model-view-projection matrix

Resize

public void Resize( int width, int height );
SetOptionBool: set boolean renderer option

ScriptingInit

protected static void ScriptingInit();

SetClearColor

public void SetClearColor( u32 color );

SetFastPlayerColor

public void SetFastPlayerColor( bool fast );
BeginFrame: signal frame start

SetLightEnv

public void SetLightEnv( CLightEnv* lightenv );

SetModelRenderMode

public void SetModelRenderMode( ERenderMode mode );

SetObliqueFrustumClipping

protected void SetObliqueFrustumClipping( const CVector4D& clipPlane, int sign );
Private data that is not needed by inline functions

SetOptionBool

public void SetOptionBool( enum CRenderer::Option opt, bool value );
GetOptionBool: get boolean renderer option

SetOptionFloat

public void SetOptionFloat( enum CRenderer::Option opt, float val );
GetOptionColor: get color renderer option const RGBAColor& CRenderer::GetOptionColor(Option UNUSED(opt)) const { static const RGBAColor defaultColor(1.0f,1.0f,1.0f,1.0f); // switch (opt) { // default: debug_warn("CRenderer::GetOptionColor: unknown option"); // break; // } return defaultColor; }

SetRenderPath

public void SetRenderPath( CRenderer::RenderPath rp );

SetSceneCamera

public void SetSceneCamera( const CCamera& viewCamera, const CCamera& cullCamera );
Set up the camera used for rendering the next scene; this includes setting OpenGL state like viewport, projection and modelview matrices.
Parameters:
viewCamera - this camera determines the eye position for rendering
cullCamera - this camera determines the frustum for culling in the renderer and for shadow calculations

SetTerrainRenderMode

public void SetTerrainRenderMode( ERenderMode mode );

SetTexture

public void SetTexture( int unit, CTexture* texture );
IsTextureTransparent: return true if given texture is transparent, else false - note texture must be loaded beforehand

SetViewport

public void SetViewport( const SViewPort& vp );

Submit

protected void Submit( CPatch* patch );

SubmitNonRecursive

protected void SubmitNonRecursive( CModel* model );
Render the given scene

UnloadAlphaMaps

public void UnloadAlphaMaps();
Scripting Interface

 Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
Generated on September 04, 2007 at 18:14
CppDoc v2.4.0
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD