| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- $#include "Renderer.h"
- /// High-level rendering subsystem. Manages drawing of 3D views.
- class Renderer
- {
- public:
- /// Set number of backbuffer viewports to render.
- void SetNumViewports(unsigned num);
- /// Set a backbuffer viewport.
- void SetViewport(unsigned index, Viewport* viewport);
- /// Set default renderpath.
- void SetDefaultRenderPath(RenderPath* renderPath);
- /// Set default renderpath from an XML file.
- void SetDefaultRenderPath(XMLFile* file);
- /// Set specular lighting on/off.
- void SetSpecularLighting(bool enable);
- /// Set texture anisotropy.
- void SetTextureAnisotropy(int level);
- /// Set texture filtering.
- void SetTextureFilterMode(TextureFilterMode mode);
- /// Set texture quality level.
- void SetTextureQuality(int quality);
- /// Set material quality level.
- void SetMaterialQuality(int quality);
- /// Set shadows on/off.
- void SetDrawShadows(bool enable);
- /// Set shadow map resolution.
- void SetShadowMapSize(int size);
- /// Set shadow quality (amount of samples and bit depth.)
- void SetShadowQuality(int quality);
- /// Set reuse of shadow maps. Default is true. If disabled, also transparent geometry can be shadowed.
- void SetReuseShadowMaps(bool enable);
- /// Set maximum number of shadow maps created for one resolution. Only has effect if reuse of shadow maps is disabled.
- void SetMaxShadowMaps(int shadowMaps);
- /// Set maximum number of directional light shadow map cascades. Affects the size of directional light shadow maps.
- void SetMaxShadowCascades(int cascades);
- /// Set dynamic instancing on/off.
- void SetDynamicInstancing(bool enable);
- /// Set minimum number of instances required in a batch group to render as instanced.
- void SetMinInstances(int instances);
- /// Set maximum number of triangles per object for instancing.
- void SetMaxInstanceTriangles(int triangles);
- /// Set maximum number of sorted instances per batch group. If exceeded, instances are rendered unsorted.
- void SetMaxSortedInstances(int instances);
- /// Set maximum number of occluder trianges.
- void SetMaxOccluderTriangles(int triangles);
- /// Set occluder buffer width.
- void SetOcclusionBufferSize(int size);
- /// Set required screen size (1.0 = full screen) for occluders.
- void SetOccluderSizeThreshold(float screenSize);
- /// Force reload of shaders.
- void ReloadShaders();
-
- /// Return number of backbuffer viewports.
- unsigned GetNumViewports() const { return viewports_.Size(); }
- /// Return backbuffer viewport by index.
- Viewport* GetViewport(unsigned index) const;
- /// Return default renderpath.
- RenderPath* GetDefaultRenderPath() const;
- /// Return whether specular lighting is enabled.
- bool GetSpecularLighting() const { return specularLighting_; }
- /// Return whether drawing shadows is enabled.
- bool GetDrawShadows() const { return drawShadows_; }
- /// Return texture anisotropy.
- int GetTextureAnisotropy() const { return textureAnisotropy_; }
- /// Return texture filtering.
- TextureFilterMode GetTextureFilterMode() const { return textureFilterMode_; }
- /// Return texture quality level.
- int GetTextureQuality() const { return textureQuality_; }
- /// Return material quality level.
- int GetMaterialQuality() const { return materialQuality_; }
- /// Return shadow map resolution.
- int GetShadowMapSize() const { return shadowMapSize_; }
- /// Return shadow quality.
- int GetShadowQuality() const { return shadowQuality_; }
- /// Return whether shadow maps are reused.
- bool GetReuseShadowMaps() const { return reuseShadowMaps_; }
- /// Return maximum number of shadow maps per resolution.
- int GetMaxShadowMaps() const { return maxShadowMaps_; }
- /// Return maximum number of directional light shadow map cascades.
- int GetMaxShadowCascades() const { return maxShadowCascades_; }
- /// Return whether dynamic instancing is in use.
- bool GetDynamicInstancing() const { return dynamicInstancing_; }
- /// Return minimum number of instances required in a batch group to render as instanced.
- int GetMinInstances() const { return minInstances_; }
- /// Return maximum number of triangles per object for instancing.
- int GetMaxInstanceTriangles() const { return maxInstanceTriangles_; }
- /// Return maximum number of sorted instances per batch group.
- int GetMaxSortedInstances() const { return maxSortedInstances_; }
- /// Return maximum number of occluder triangles.
- int GetMaxOccluderTriangles() const { return maxOccluderTriangles_; }
- /// Return occlusion buffer width.
- int GetOcclusionBufferSize() const { return occlusionBufferSize_; }
- /// Return occluder screen size threshold.
- float GetOccluderSizeThreshold() const { return occluderSizeThreshold_; }
- /// Return number of views rendered.
- unsigned GetNumViews() const { return numViews_; }
- /// Return number of primitives rendered.
- unsigned GetNumPrimitives() const { return numPrimitives_; }
- /// Return number of batches rendered.
- unsigned GetNumBatches() const { return numBatches_; }
- /// Return number of geometries rendered.
- unsigned GetNumGeometries(bool allViews = false) const;
- /// Return number of lights rendered.
- unsigned GetNumLights(bool allViews = false) const;
- /// Return number of shadow maps rendered.
- unsigned GetNumShadowMaps(bool allViews = false) const;
- /// Return number of occluders rendered.
- unsigned GetNumOccluders(bool allViews = false) const;
- /// Return the default zone.
- Zone* GetDefaultZone() const { return defaultZone_; }
- /// Return the directional light for fullscreen quad rendering.
- Light* GetQuadDirLight() const { return quadDirLight_; }
- /// Return the default material.
- Material* GetDefaultMaterial() const { return defaultMaterial_; }
- /// Return the default range attenuation texture.
- Texture2D* GetDefaultLightRamp() const { return defaultLightRamp_; }
- /// Return the default spotlight attenuation texture.
- Texture2D* GetDefaultLightSpot() const { return defaultLightSpot_; }
- /// Return the shadowed pointlight face selection cube map.
- TextureCube* GetFaceSelectCubeMap() const { return faceSelectCubeMap_; }
- /// Return the shadowed pointlight indirection cube map.
- TextureCube* GetIndirectionCubeMap() const { return indirectionCubeMap_; }
- /// Return the instancing vertex buffer
- VertexBuffer* GetInstancingBuffer() const { return dynamicInstancing_ ? instancingBuffer_ : (VertexBuffer*)0; }
- /// Return a vertex shader by name.
- ShaderVariation* GetVertexShader(const String& name, bool checkExists = false) const;
- /// Return a pixel shader by name.
- ShaderVariation* GetPixelShader(const String& name, bool checkExists = false) const;
- /// Return the stencil vertex shader.
- ShaderVariation* GetStencilVS() const { return stencilVS_; }
- /// Return the stencil pixel shader.
- ShaderVariation* GetStencilPS() const { return stencilPS_; }
- /// Return the frame update parameters.
- const FrameInfo& GetFrameInfo() { return frame_; }
-
- /// Add debug geometry to the debug renderer.
- void DrawDebugGeometry(bool depthTest);
- };
|