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 #include <UT/UT_NonCopyable.h>
20 
21 class RE_OGLTexture;
22 class RE_Render;
23 
25 {
26 public:
27  RE_LightBatch(int max_lights,
29  bool use_ssbo = false);
30  ~RE_LightBatch();
31 
33 
34  RE_Light::RE_HQLightType batchType() const { return myLightType; }
35 
36  static RE_LightBatch *findBatch(int id);
37 
38  int getID() const { return myID; }
39  int batchSize() const { return myLights.entries(); }
40 
41  bool addLight(RE_Light *light);
42  void removeLight(RE_Light *light);
43 
44  void prepareBatch(RE_Render *r, int area_samples = 1);
45 
46  void prepShadowMap(RE_Render *r, int res);
47 
48  void bindToShader(RE_Render *r, RE_Shader *sh);
49  void unbindFromShader(RE_Render *r, RE_Shader *sh);
50 
51  const UT_Array<RE_Light *> &lights() { return myLights; }
52 
53  void dump();
54 private:
55 
56  void updateLightBlocks(RE_Render *r);
57 
58  bool myUseSSBO;
59 
60  UT_Array<RE_Light *> mySetupLights;
61  UT_Array<RE_Light *> myLights;
62 
63  RE_Light::RE_HQLightType myLightType;
64  int myMaxLights;
65  int myCurrentMax;
66  int myID;
67 
68  RE_UniformBlockHandle myHQLightBlock;
69  RE_UniformBlockHandle myAreaBlock;
70  RE_UniformBlockHandle myBasicBlock;
71  RE_UniformBlockHandle myUniformBlock;
72  bool myUniformBound;
73  bool myBasicBound;
74  bool myHQBound;
75  bool myAreaBound;
76 
77  RE_OGLTexture *myFalloffArray;
78  RE_OGLTexture *myShadowArray;
79 };
80 
81 #endif
int batchSize() const
Definition: RE_LightBatch.h:39
RE_HQLightType
Definition: RE_Light.h:384
#define RE_API
Definition: RE_API.h:10
const UT_Array< RE_Light * > & lights()
Definition: RE_LightBatch.h:51
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
int getID() const
Definition: RE_LightBatch.h:38
GLboolean r
Definition: glcorearb.h:1222