HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE_LightBatch.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: RE_LightBatch ( RE Library, C++)
7  *
8  * COMMENTS:
9  * A small batch of lights of similar type which can be rendered in a
10  * single HQ Lighting pass together. Their uniforms are stored in a single
11  * SSBO and their shadow maps in a single array map (cube or 2D).
12  */
13 #ifndef RE_LightBatch_h
14 #define RE_LightBatch_h
15 
16 #include "RE_API.h"
17 #include "RE_Light.h"
18 #include "RE_UniformBlock.h"
19 
20 class RE_OGLTexture;
21 class RE_Render;
22 
24 {
25 public:
26  RE_LightBatch(int max_lights,
28  bool use_ssbo = false);
29  ~RE_LightBatch();
30 
31  RE_Light::RE_HQLightType batchType() const { return myLightType; }
32 
33  static RE_LightBatch *findBatch(int id);
34 
35  int getID() const { return myID; }
36  int batchSize() const { return myLights.entries(); }
37 
38  bool addLight(RE_Light *light);
39  void removeLight(RE_Light *light);
40 
41  void prepareBatch(RE_Render *r, int area_samples = 1);
42 
43  void prepShadowMap(RE_Render *r, int res);
44 
45  void bindToShader(RE_Render *r, RE_Shader *sh);
46  void unbindFromShader(RE_Render *r, RE_Shader *sh);
47 
48  const UT_Array<RE_Light *> &lights() { return myLights; }
49 
50  void dump();
51 private:
52 
53  void updateLightBlocks(RE_Render *r);
54 
55  bool myUseSSBO;
56 
57  UT_Array<RE_Light *> mySetupLights;
58  UT_Array<RE_Light *> myLights;
59 
60  RE_Light::RE_HQLightType myLightType;
61  int myMaxLights;
62  int myCurrentMax;
63  int myID;
64 
65  RE_UniformBlockHandle myHQLightBlock;
66  RE_UniformBlockHandle myAreaBlock;
67  RE_UniformBlockHandle myBasicBlock;
68  RE_UniformBlockHandle myUniformBlock;
69  bool myUniformBound;
70  bool myBasicBound;
71  bool myHQBound;
72  bool myAreaBound;
73 
74  RE_OGLTexture *myFalloffArray;
75  RE_OGLTexture *myShadowArray;
76 };
77 
78 #endif
RE_Light::RE_HQLightType batchType() const
Definition: RE_LightBatch.h:31
int batchSize() const
Definition: RE_LightBatch.h:36
RE_HQLightType
Definition: RE_Light.h:373
#define RE_API
Definition: RE_API.h:10
const UT_Array< RE_Light * > & lights()
Definition: RE_LightBatch.h:48
int getID() const
Definition: RE_LightBatch.h:35
GLboolean r
Definition: glcorearb.h:1222
type
Definition: core.h:1059