Renderer.pkg 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. $#include "Renderer.h"
  2. /// High-level rendering subsystem. Manages drawing of 3D views.
  3. class Renderer
  4. {
  5. public:
  6. /// Set number of backbuffer viewports to render.
  7. void SetNumViewports(unsigned num);
  8. /// Set a backbuffer viewport.
  9. void SetViewport(unsigned index, Viewport* viewport);
  10. /// Set default renderpath.
  11. void SetDefaultRenderPath(RenderPath* renderPath);
  12. /// Set default renderpath from an XML file.
  13. void SetDefaultRenderPath(XMLFile* file);
  14. /// Set specular lighting on/off.
  15. void SetSpecularLighting(bool enable);
  16. /// Set texture anisotropy.
  17. void SetTextureAnisotropy(int level);
  18. /// Set texture filtering.
  19. void SetTextureFilterMode(TextureFilterMode mode);
  20. /// Set texture quality level.
  21. void SetTextureQuality(int quality);
  22. /// Set material quality level.
  23. void SetMaterialQuality(int quality);
  24. /// Set shadows on/off.
  25. void SetDrawShadows(bool enable);
  26. /// Set shadow map resolution.
  27. void SetShadowMapSize(int size);
  28. /// Set shadow quality (amount of samples and bit depth.)
  29. void SetShadowQuality(int quality);
  30. /// Set reuse of shadow maps. Default is true. If disabled, also transparent geometry can be shadowed.
  31. void SetReuseShadowMaps(bool enable);
  32. /// Set maximum number of shadow maps created for one resolution. Only has effect if reuse of shadow maps is disabled.
  33. void SetMaxShadowMaps(int shadowMaps);
  34. /// Set maximum number of directional light shadow map cascades. Affects the size of directional light shadow maps.
  35. void SetMaxShadowCascades(int cascades);
  36. /// Set dynamic instancing on/off.
  37. void SetDynamicInstancing(bool enable);
  38. /// Set minimum number of instances required in a batch group to render as instanced.
  39. void SetMinInstances(int instances);
  40. /// Set maximum number of triangles per object for instancing.
  41. void SetMaxInstanceTriangles(int triangles);
  42. /// Set maximum number of sorted instances per batch group. If exceeded, instances are rendered unsorted.
  43. void SetMaxSortedInstances(int instances);
  44. /// Set maximum number of occluder trianges.
  45. void SetMaxOccluderTriangles(int triangles);
  46. /// Set occluder buffer width.
  47. void SetOcclusionBufferSize(int size);
  48. /// Set required screen size (1.0 = full screen) for occluders.
  49. void SetOccluderSizeThreshold(float screenSize);
  50. /// Force reload of shaders.
  51. void ReloadShaders();
  52. /// Return number of backbuffer viewports.
  53. unsigned GetNumViewports() const { return viewports_.Size(); }
  54. /// Return backbuffer viewport by index.
  55. Viewport* GetViewport(unsigned index) const;
  56. /// Return default renderpath.
  57. RenderPath* GetDefaultRenderPath() const;
  58. /// Return whether specular lighting is enabled.
  59. bool GetSpecularLighting() const { return specularLighting_; }
  60. /// Return whether drawing shadows is enabled.
  61. bool GetDrawShadows() const { return drawShadows_; }
  62. /// Return texture anisotropy.
  63. int GetTextureAnisotropy() const { return textureAnisotropy_; }
  64. /// Return texture filtering.
  65. TextureFilterMode GetTextureFilterMode() const { return textureFilterMode_; }
  66. /// Return texture quality level.
  67. int GetTextureQuality() const { return textureQuality_; }
  68. /// Return material quality level.
  69. int GetMaterialQuality() const { return materialQuality_; }
  70. /// Return shadow map resolution.
  71. int GetShadowMapSize() const { return shadowMapSize_; }
  72. /// Return shadow quality.
  73. int GetShadowQuality() const { return shadowQuality_; }
  74. /// Return whether shadow maps are reused.
  75. bool GetReuseShadowMaps() const { return reuseShadowMaps_; }
  76. /// Return maximum number of shadow maps per resolution.
  77. int GetMaxShadowMaps() const { return maxShadowMaps_; }
  78. /// Return maximum number of directional light shadow map cascades.
  79. int GetMaxShadowCascades() const { return maxShadowCascades_; }
  80. /// Return whether dynamic instancing is in use.
  81. bool GetDynamicInstancing() const { return dynamicInstancing_; }
  82. /// Return minimum number of instances required in a batch group to render as instanced.
  83. int GetMinInstances() const { return minInstances_; }
  84. /// Return maximum number of triangles per object for instancing.
  85. int GetMaxInstanceTriangles() const { return maxInstanceTriangles_; }
  86. /// Return maximum number of sorted instances per batch group.
  87. int GetMaxSortedInstances() const { return maxSortedInstances_; }
  88. /// Return maximum number of occluder triangles.
  89. int GetMaxOccluderTriangles() const { return maxOccluderTriangles_; }
  90. /// Return occlusion buffer width.
  91. int GetOcclusionBufferSize() const { return occlusionBufferSize_; }
  92. /// Return occluder screen size threshold.
  93. float GetOccluderSizeThreshold() const { return occluderSizeThreshold_; }
  94. /// Return number of views rendered.
  95. unsigned GetNumViews() const { return numViews_; }
  96. /// Return number of primitives rendered.
  97. unsigned GetNumPrimitives() const { return numPrimitives_; }
  98. /// Return number of batches rendered.
  99. unsigned GetNumBatches() const { return numBatches_; }
  100. /// Return number of geometries rendered.
  101. unsigned GetNumGeometries(bool allViews = false) const;
  102. /// Return number of lights rendered.
  103. unsigned GetNumLights(bool allViews = false) const;
  104. /// Return number of shadow maps rendered.
  105. unsigned GetNumShadowMaps(bool allViews = false) const;
  106. /// Return number of occluders rendered.
  107. unsigned GetNumOccluders(bool allViews = false) const;
  108. /// Return the default zone.
  109. Zone* GetDefaultZone() const { return defaultZone_; }
  110. /// Return the directional light for fullscreen quad rendering.
  111. Light* GetQuadDirLight() const { return quadDirLight_; }
  112. /// Return the default material.
  113. Material* GetDefaultMaterial() const { return defaultMaterial_; }
  114. /// Return the default range attenuation texture.
  115. Texture2D* GetDefaultLightRamp() const { return defaultLightRamp_; }
  116. /// Return the default spotlight attenuation texture.
  117. Texture2D* GetDefaultLightSpot() const { return defaultLightSpot_; }
  118. /// Return the shadowed pointlight face selection cube map.
  119. TextureCube* GetFaceSelectCubeMap() const { return faceSelectCubeMap_; }
  120. /// Return the shadowed pointlight indirection cube map.
  121. TextureCube* GetIndirectionCubeMap() const { return indirectionCubeMap_; }
  122. /// Return the instancing vertex buffer
  123. VertexBuffer* GetInstancingBuffer() const { return dynamicInstancing_ ? instancingBuffer_ : (VertexBuffer*)0; }
  124. /// Return a vertex shader by name.
  125. ShaderVariation* GetVertexShader(const String& name, bool checkExists = false) const;
  126. /// Return a pixel shader by name.
  127. ShaderVariation* GetPixelShader(const String& name, bool checkExists = false) const;
  128. /// Return the stencil vertex shader.
  129. ShaderVariation* GetStencilVS() const { return stencilVS_; }
  130. /// Return the stencil pixel shader.
  131. ShaderVariation* GetStencilPS() const { return stencilPS_; }
  132. /// Return the frame update parameters.
  133. const FrameInfo& GetFrameInfo() { return frame_; }
  134. /// Add debug geometry to the debug renderer.
  135. void DrawDebugGeometry(bool depthTest);
  136. };