Renderer.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. //
  2. // Copyright (c) 2008-2014 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include "Batch.h"
  24. #include "Color.h"
  25. #include "Drawable.h"
  26. #include "HashSet.h"
  27. #include "Mutex.h"
  28. #include "Viewport.h"
  29. namespace Urho3D
  30. {
  31. class Geometry;
  32. class Drawable;
  33. class Light;
  34. class Material;
  35. class Pass;
  36. class Technique;
  37. class Octree;
  38. class Graphics;
  39. class RenderPath;
  40. class RenderSurface;
  41. class ResourceCache;
  42. class Skeleton;
  43. class OcclusionBuffer;
  44. class Texture2D;
  45. class TextureCube;
  46. class View;
  47. class Zone;
  48. static const int SHADOW_MIN_PIXELS = 64;
  49. static const int INSTANCING_BUFFER_DEFAULT_SIZE = 1024;
  50. /// Light vertex shader variations.
  51. enum LightVSVariation
  52. {
  53. LVS_DIR = 0,
  54. LVS_SPOT,
  55. LVS_POINT,
  56. LVS_SPEC,
  57. LVS_SPOTSPEC,
  58. LVS_POINTSPEC,
  59. LVS_SHADOW,
  60. LVS_SPOTSHADOW,
  61. LVS_POINTSHADOW,
  62. LVS_DIRSPECSHADOW,
  63. LVS_SPOTSPECSHADOW,
  64. LVS_POINTSPECSHADOW,
  65. MAX_LIGHT_VS_VARIATIONS
  66. };
  67. /// Per-vertex light vertex shader variations.
  68. enum VertexLightVSVariation
  69. {
  70. VLVS_NOLIGHTS = 0,
  71. VLVS_1LIGHT,
  72. VLVS_2LIGHTS,
  73. VLVS_3LIGHTS,
  74. VLVS_4LIGHTS,
  75. MAX_VERTEXLIGHT_VS_VARIATIONS
  76. };
  77. /// Light pixel shader variations.
  78. enum LightPSVariation
  79. {
  80. LPS_NONE = 0,
  81. LPS_SPOT,
  82. LPS_POINT,
  83. LPS_POINTMASK,
  84. LPS_SPEC,
  85. LPS_SPOTSPEC,
  86. LPS_POINTSPEC,
  87. LPS_POINTMASKSPEC,
  88. LPS_SHADOW,
  89. LPS_SPOTSHADOW,
  90. LPS_POINTSHADOW,
  91. LPS_POINTMASKSHADOW,
  92. LPS_SHADOWSPEC,
  93. LPS_SPOTSHADOWSPEC,
  94. LPS_POINTSHADOWSPEC,
  95. LPS_POINTMASKSHADOWSPEC,
  96. MAX_LIGHT_PS_VARIATIONS
  97. };
  98. /// Deferred light volume vertex shader variations.
  99. enum DeferredLightVSVariation
  100. {
  101. DLVS_NONE = 0,
  102. DLVS_DIR,
  103. DLVS_ORTHO,
  104. DLVS_ORTHODIR,
  105. MAX_DEFERRED_LIGHT_VS_VARIATIONS
  106. };
  107. /// Deferred light volume pixels shader variations.
  108. enum DeferredLightPSVariation
  109. {
  110. DLPS_NONE = 0,
  111. DLPS_SPOT,
  112. DLPS_POINT,
  113. DLPS_POINTMASK,
  114. DLPS_SPEC,
  115. DLPS_SPOTSPEC,
  116. DLPS_POINTSPEC,
  117. DLPS_POINTMASKSPEC,
  118. DLPS_SHADOW,
  119. DLPS_SPOTSHADOW,
  120. DLPS_POINTSHADOW,
  121. DLPS_POINTMASKSHADOW,
  122. DLPS_SHADOWSPEC,
  123. DLPS_SPOTSHADOWSPEC,
  124. DLPS_POINTSHADOWSPEC,
  125. DLPS_POINTMASKSHADOWSPEC,
  126. DLPS_ORTHO,
  127. DLPS_ORTHOSPOT,
  128. DLPS_ORTHOPOINT,
  129. DLPS_ORTHOPOINTMASK,
  130. DLPS_ORTHOSPEC,
  131. DLPS_ORTHOSPOTSPEC,
  132. DLPS_ORTHOPOINTSPEC,
  133. DLPS_ORTHOPOINTMASKSPEC,
  134. DLPS_ORTHOSHADOW,
  135. DLPS_ORTHOSPOTSHADOW,
  136. DLPS_ORTHOPOINTSHADOW,
  137. DLPS_ORTHOPOINTMASKSHADOW,
  138. DLPS_ORTHOSHADOWSPEC,
  139. DLPS_ORTHOSPOTSHADOWSPEC,
  140. DLPS_ORTHOPOINTSHADOWSPEC,
  141. DLPS_ORTHOPOINTMASKSHADOWSPEC,
  142. MAX_DEFERRED_LIGHT_PS_VARIATIONS
  143. };
  144. /// High-level rendering subsystem. Manages drawing of 3D views.
  145. class URHO3D_API Renderer : public Object
  146. {
  147. OBJECT(Object);
  148. public:
  149. /// Construct.
  150. Renderer(Context* context);
  151. /// Destruct.
  152. virtual ~Renderer();
  153. /// Set number of backbuffer viewports to render.
  154. void SetNumViewports(unsigned num);
  155. /// Set a backbuffer viewport.
  156. void SetViewport(unsigned index, Viewport* viewport);
  157. /// Set default renderpath.
  158. void SetDefaultRenderPath(RenderPath* renderPath);
  159. /// Set default renderpath from an XML file.
  160. void SetDefaultRenderPath(XMLFile* file);
  161. /// Set HDR rendering on/off.
  162. void SetHDRRendering(bool enable);
  163. /// Set specular lighting on/off.
  164. void SetSpecularLighting(bool enable);
  165. /// Set texture anisotropy.
  166. void SetTextureAnisotropy(int level);
  167. /// Set texture filtering.
  168. void SetTextureFilterMode(TextureFilterMode mode);
  169. /// Set texture quality level.
  170. void SetTextureQuality(int quality);
  171. /// Set material quality level.
  172. void SetMaterialQuality(int quality);
  173. /// Set shadows on/off.
  174. void SetDrawShadows(bool enable);
  175. /// Set shadow map resolution.
  176. void SetShadowMapSize(int size);
  177. /// Set shadow quality (amount of samples and bit depth.)
  178. void SetShadowQuality(int quality);
  179. /// Set reuse of shadow maps. Default is true. If disabled, also transparent geometry can be shadowed.
  180. void SetReuseShadowMaps(bool enable);
  181. /// Set maximum number of shadow maps created for one resolution. Only has effect if reuse of shadow maps is disabled.
  182. void SetMaxShadowMaps(int shadowMaps);
  183. /// Set maximum number of directional light shadow map cascades. Affects the size of directional light shadow maps.
  184. void SetMaxShadowCascades(int cascades);
  185. /// Set dynamic instancing on/off.
  186. void SetDynamicInstancing(bool enable);
  187. /// Set minimum number of instances required in a batch group to render as instanced.
  188. void SetMinInstances(int instances);
  189. /// Set maximum number of triangles per object for instancing.
  190. void SetMaxInstanceTriangles(int triangles);
  191. /// Set maximum number of sorted instances per batch group. If exceeded, instances are rendered unsorted.
  192. void SetMaxSortedInstances(int instances);
  193. /// Set maximum number of occluder trianges.
  194. void SetMaxOccluderTriangles(int triangles);
  195. /// Set occluder buffer width.
  196. void SetOcclusionBufferSize(int size);
  197. /// Set required screen size (1.0 = full screen) for occluders.
  198. void SetOccluderSizeThreshold(float screenSize);
  199. /// Force reload of shaders.
  200. void ReloadShaders();
  201. /// Return number of backbuffer viewports.
  202. unsigned GetNumViewports() const { return viewports_.Size(); }
  203. /// Return backbuffer viewport by index.
  204. Viewport* GetViewport(unsigned index) const;
  205. /// Return default renderpath.
  206. RenderPath* GetDefaultRenderPath() const;
  207. /// Return whether HDR rendering is enabled.
  208. bool GetHDRRendering() const { return hdrRendering_; }
  209. /// Return whether specular lighting is enabled.
  210. bool GetSpecularLighting() const { return specularLighting_; }
  211. /// Return whether drawing shadows is enabled.
  212. bool GetDrawShadows() const { return drawShadows_; }
  213. /// Return texture anisotropy.
  214. int GetTextureAnisotropy() const { return textureAnisotropy_; }
  215. /// Return texture filtering.
  216. TextureFilterMode GetTextureFilterMode() const { return textureFilterMode_; }
  217. /// Return texture quality level.
  218. int GetTextureQuality() const { return textureQuality_; }
  219. /// Return material quality level.
  220. int GetMaterialQuality() const { return materialQuality_; }
  221. /// Return shadow map resolution.
  222. int GetShadowMapSize() const { return shadowMapSize_; }
  223. /// Return shadow quality.
  224. int GetShadowQuality() const { return shadowQuality_; }
  225. /// Return whether shadow maps are reused.
  226. bool GetReuseShadowMaps() const { return reuseShadowMaps_; }
  227. /// Return maximum number of shadow maps per resolution.
  228. int GetMaxShadowMaps() const { return maxShadowMaps_; }
  229. /// Return maximum number of directional light shadow map cascades.
  230. int GetMaxShadowCascades() const { return maxShadowCascades_; }
  231. /// Return whether dynamic instancing is in use.
  232. bool GetDynamicInstancing() const { return dynamicInstancing_; }
  233. /// Return minimum number of instances required in a batch group to render as instanced.
  234. int GetMinInstances() const { return minInstances_; }
  235. /// Return maximum number of triangles per object for instancing.
  236. int GetMaxInstanceTriangles() const { return maxInstanceTriangles_; }
  237. /// Return maximum number of sorted instances per batch group.
  238. int GetMaxSortedInstances() const { return maxSortedInstances_; }
  239. /// Return maximum number of occluder triangles.
  240. int GetMaxOccluderTriangles() const { return maxOccluderTriangles_; }
  241. /// Return occlusion buffer width.
  242. int GetOcclusionBufferSize() const { return occlusionBufferSize_; }
  243. /// Return occluder screen size threshold.
  244. float GetOccluderSizeThreshold() const { return occluderSizeThreshold_; }
  245. /// Return number of views rendered.
  246. unsigned GetNumViews() const { return numViews_; }
  247. /// Return number of primitives rendered.
  248. unsigned GetNumPrimitives() const { return numPrimitives_; }
  249. /// Return number of batches rendered.
  250. unsigned GetNumBatches() const { return numBatches_; }
  251. /// Return number of geometries rendered.
  252. unsigned GetNumGeometries(bool allViews = false) const;
  253. /// Return number of lights rendered.
  254. unsigned GetNumLights(bool allViews = false) const;
  255. /// Return number of shadow maps rendered.
  256. unsigned GetNumShadowMaps(bool allViews = false) const;
  257. /// Return number of occluders rendered.
  258. unsigned GetNumOccluders(bool allViews = false) const;
  259. /// Return the default zone.
  260. Zone* GetDefaultZone() const { return defaultZone_; }
  261. /// Return the directional light for fullscreen quad rendering.
  262. Light* GetQuadDirLight() const { return quadDirLight_; }
  263. /// Return the default material.
  264. Material* GetDefaultMaterial() const { return defaultMaterial_; }
  265. /// Return the default range attenuation texture.
  266. Texture2D* GetDefaultLightRamp() const { return defaultLightRamp_; }
  267. /// Return the default spotlight attenuation texture.
  268. Texture2D* GetDefaultLightSpot() const { return defaultLightSpot_; }
  269. /// Return the shadowed pointlight face selection cube map.
  270. TextureCube* GetFaceSelectCubeMap() const { return faceSelectCubeMap_; }
  271. /// Return the shadowed pointlight indirection cube map.
  272. TextureCube* GetIndirectionCubeMap() const { return indirectionCubeMap_; }
  273. /// Return the instancing vertex buffer
  274. VertexBuffer* GetInstancingBuffer() const { return dynamicInstancing_ ? instancingBuffer_ : (VertexBuffer*)0; }
  275. /// Return a vertex shader by name.
  276. ShaderVariation* GetVertexShader(const String& name, bool checkExists = false) const;
  277. /// Return a pixel shader by name.
  278. ShaderVariation* GetPixelShader(const String& name, bool checkExists = false) const;
  279. /// Return the stencil vertex shader.
  280. ShaderVariation* GetStencilVS() const { return stencilVS_; }
  281. /// Return the stencil pixel shader.
  282. ShaderVariation* GetStencilPS() const { return stencilPS_; }
  283. /// Return the frame update parameters.
  284. const FrameInfo& GetFrameInfo() { return frame_; }
  285. /// Update for rendering. Called by HandleRenderUpdate().
  286. void Update(float timeStep);
  287. /// Render. Called by Engine.
  288. void Render();
  289. /// Add debug geometry to the debug renderer.
  290. void DrawDebugGeometry(bool depthTest);
  291. /// Queue a render surface's viewports for rendering. Called by the surface, or by View.
  292. void QueueRenderSurface(RenderSurface* renderTarget);
  293. /// Queue a viewport for rendering. Null surface means backbuffer.
  294. void QueueViewport(RenderSurface* renderTarget, Viewport* viewport);
  295. /// Populate light volume shaders.
  296. void GetLightVolumeShaders(PODVector<ShaderVariation*>& lightVS, PODVector<ShaderVariation*>& lightPS, const String& vsName, const String& psName);
  297. /// Return volume geometry for a light.
  298. Geometry* GetLightGeometry(Light* light);
  299. /// Allocate a shadow map. If shadow map reuse is disabled, a different map is returned each time.
  300. Texture2D* GetShadowMap(Light* light, Camera* camera, unsigned viewWidth, unsigned viewHeight);
  301. /// Allocate a rendertarget or depth-stencil texture for deferred rendering or postprocessing. Should only be called during actual rendering, not before.
  302. Texture2D* GetScreenBuffer(int width, int height, unsigned format, bool filtered, bool srgb);
  303. /// Allocate a depth-stencil surface that does not need to be readable. Should only be called during actual rendering, not before.
  304. RenderSurface* GetDepthStencil(int width, int height);
  305. /// Allocate an occlusion buffer.
  306. OcclusionBuffer* GetOcclusionBuffer(Camera* camera);
  307. /// Allocate a temporary shadow camera and a scene node for it. Is thread-safe.
  308. Camera* GetShadowCamera();
  309. /// Get a shader program.
  310. ShaderVariation* GetShader(ShaderType type, const String& name, bool checkExists) const;
  311. /// Choose shaders for a forward rendering batch.
  312. void SetBatchShaders(Batch& batch, Technique* tech, bool allowShadows = true);
  313. /// Choose shaders for a light volume batch.
  314. void SetLightVolumeBatchShaders(Batch& batch, PODVector<ShaderVariation*>& lightVS, PODVector<ShaderVariation*>& lightPS);
  315. /// Set cull mode while taking possible projection flipping into account.
  316. void SetCullMode(CullMode mode, Camera* camera);
  317. /// Ensure sufficient size of the instancing vertex buffer. Return true if successful.
  318. bool ResizeInstancingBuffer(unsigned numInstances);
  319. /// Save the screen buffer allocation status. Called by View.
  320. void SaveScreenBufferAllocations();
  321. /// Restore the screen buffer allocation status. Called by View.
  322. void RestoreScreenBufferAllocations();
  323. /// Optimize a light by scissor rectangle.
  324. void OptimizeLightByScissor(Light* light, Camera* camera);
  325. /// Optimize a light by marking it to the stencil buffer and setting a stencil test.
  326. void OptimizeLightByStencil(Light* light, Camera* camera);
  327. /// Return a scissor rectangle for a light.
  328. const Rect& GetLightScissor(Light* light, Camera* camera);
  329. private:
  330. /// Initialize when screen mode initially set.
  331. void Initialize();
  332. /// Clear views from previous frame.
  333. void ResetViews();
  334. /// Reload shaders.
  335. void LoadShaders();
  336. /// Reload shaders for a material pass.
  337. void LoadPassShaders(Technique* tech, StringHash passType);
  338. /// Release shaders used in materials.
  339. void ReleaseMaterialShaders();
  340. /// Reload textures.
  341. void ReloadTextures();
  342. /// Create light volume geometries.
  343. void CreateGeometries();
  344. /// Create instancing vertex buffer.
  345. void CreateInstancingBuffer();
  346. /// Create point light shadow indirection texture data.
  347. void SetIndirectionTextureData();
  348. /// Prepare for rendering of a new view.
  349. void PrepareViewRender();
  350. /// Remove unused occlusion and screen buffers.
  351. void RemoveUnusedBuffers();
  352. /// Reset shadow map allocation counts.
  353. void ResetShadowMapAllocations();
  354. /// Reset screem buffer allocation counts.
  355. void ResetScreenBufferAllocations();
  356. /// Remove all shadow maps. Called when global shadow map resolution or format is changed.
  357. void ResetShadowMaps();
  358. /// Remove all occlusion and screen buffers.
  359. void ResetBuffers();
  360. /// Handle screen mode event.
  361. void HandleScreenMode(StringHash eventType, VariantMap& eventData);
  362. /// Handle graphics features (re)check event. Event only sent by D3D9Graphics class.
  363. void HandleGraphicsFeatures(StringHash eventType, VariantMap& eventData);
  364. /// Handle render update event.
  365. void HandleRenderUpdate(StringHash eventType, VariantMap& eventData);
  366. /// Graphics subsystem.
  367. WeakPtr<Graphics> graphics_;
  368. /// Default renderpath.
  369. SharedPtr<RenderPath> defaultRenderPath_;
  370. /// Default zone.
  371. SharedPtr<Zone> defaultZone_;
  372. /// Directional light for drawing fullscreen quads.
  373. SharedPtr<Light> quadDirLight_;
  374. /// Directional light quad geometry.
  375. SharedPtr<Geometry> dirLightGeometry_;
  376. /// Spot light volume geometry.
  377. SharedPtr<Geometry> spotLightGeometry_;
  378. /// Point light volume geometry.
  379. SharedPtr<Geometry> pointLightGeometry_;
  380. /// Instance stream vertex buffer.
  381. SharedPtr<VertexBuffer> instancingBuffer_;
  382. /// Default material.
  383. SharedPtr<Material> defaultMaterial_;
  384. /// Default range attenuation texture.
  385. SharedPtr<Texture2D> defaultLightRamp_;
  386. /// Default spotlight attenuation texture.
  387. SharedPtr<Texture2D> defaultLightSpot_;
  388. /// Face selection cube map for shadowed pointlights.
  389. SharedPtr<TextureCube> faceSelectCubeMap_;
  390. /// Indirection cube map for shadowed pointlights.
  391. SharedPtr<TextureCube> indirectionCubeMap_;
  392. /// Stencil rendering vertex shader.
  393. SharedPtr<ShaderVariation> stencilVS_;
  394. /// Stencil rendering pixel shader.
  395. SharedPtr<ShaderVariation> stencilPS_;
  396. /// Reusable scene nodes with shadow camera components.
  397. Vector<SharedPtr<Node> > shadowCameraNodes_;
  398. /// Reusable occlusion buffers.
  399. Vector<SharedPtr<OcclusionBuffer> > occlusionBuffers_;
  400. /// Shadow maps by resolution.
  401. HashMap<int, Vector<SharedPtr<Texture2D> > > shadowMaps_;
  402. /// Shadow map dummy color buffers by resolution.
  403. HashMap<int, SharedPtr<Texture2D> > colorShadowMaps_;
  404. /// Shadow map allocations by resolution.
  405. HashMap<int, PODVector<Light*> > shadowMapAllocations_;
  406. /// Screen buffers by resolution and format.
  407. HashMap<long long, Vector<SharedPtr<Texture2D> > > screenBuffers_;
  408. /// Current screen buffer allocations by resolution and format.
  409. HashMap<long long, unsigned> screenBufferAllocations_;
  410. /// Saved status of screen buffer allocations for restoring.
  411. HashMap<long long, unsigned> savedScreenBufferAllocations_;
  412. /// Cache for light scissor queries.
  413. HashMap<Pair<Light*, Camera*>, Rect> lightScissorCache_;
  414. /// Viewports.
  415. Vector<SharedPtr<Viewport> > viewports_;
  416. /// Queued views.
  417. Vector<Pair<WeakPtr<RenderSurface>, WeakPtr<Viewport> > > queuedViews_;
  418. /// Views.
  419. Vector<SharedPtr<View> > views_;
  420. /// Octrees that have been updated during the frame.
  421. HashSet<Octree*> updatedOctrees_;
  422. /// Techniques for which missing shader error has been displayed.
  423. HashSet<Technique*> shaderErrorDisplayed_;
  424. /// Mutex for shadow camera allocation.
  425. Mutex rendererMutex_;
  426. /// Base directory for shaders.
  427. String shaderPath_;
  428. /// Frame info for rendering.
  429. FrameInfo frame_;
  430. /// Texture anisotropy level.
  431. int textureAnisotropy_;
  432. /// Texture filtering mode.
  433. TextureFilterMode textureFilterMode_;
  434. /// Texture quality level.
  435. int textureQuality_;
  436. /// Material quality level.
  437. int materialQuality_;
  438. /// Shadow map resolution.
  439. int shadowMapSize_;
  440. /// Shadow quality.
  441. int shadowQuality_;
  442. /// Maximum number of shadow maps per resolution.
  443. int maxShadowMaps_;
  444. /// Maximum number of directional light shadow cascades.
  445. int maxShadowCascades_;
  446. /// Minimum number of instances required in a batch group to render as instanced.
  447. int minInstances_;
  448. /// Maximum triangles per object for instancing.
  449. int maxInstanceTriangles_;
  450. /// Maximum sorted instances per batch group.
  451. int maxSortedInstances_;
  452. /// Maximum occluder triangles.
  453. int maxOccluderTriangles_;
  454. /// Occlusion buffer width.
  455. int occlusionBufferSize_;
  456. /// Occluder screen size threshold.
  457. float occluderSizeThreshold_;
  458. /// Number of views.
  459. unsigned numViews_;
  460. /// Number of occlusion buffers in use.
  461. unsigned numOcclusionBuffers_;
  462. /// Number of temporary shadow cameras in use.
  463. unsigned numShadowCameras_;
  464. /// Number of primitives (3D geometry only.)
  465. unsigned numPrimitives_;
  466. /// Number of batches (3D geometry only.)
  467. unsigned numBatches_;
  468. /// Frame number on which shaders last changed.
  469. unsigned shadersChangedFrameNumber_;
  470. /// Current stencil value for light optimization.
  471. unsigned char lightStencilValue_;
  472. /// HDR rendering flag.
  473. bool hdrRendering_;
  474. /// Specular lighting flag.
  475. bool specularLighting_;
  476. /// Draw shadows flag.
  477. bool drawShadows_;
  478. /// Shadow map reuse flag.
  479. bool reuseShadowMaps_;
  480. /// Dynamic instancing flag.
  481. bool dynamicInstancing_;
  482. /// Shaders need reloading flag.
  483. bool shadersDirty_;
  484. /// Initialized flag.
  485. bool initialized_;
  486. };
  487. }