glrender.h
1 /************************************************************
2 * (C) Voxel Farm Inc. 2015
3 */
4 
5 #pragma once
6 
7 #include <gl\glew.h>
8 //#include <gl\glaux.h>
9 #include "VoxelFarm.h"
10 #include "scene.h"
11 #include "ClipmapView.h"
12 #include "ClipmapVisibility.h"
13 #include "CellData.h"
14 #include <map>
15 
16 namespace VoxelFarm
17 {
19  namespace GL
20  {
21  struct RGBImageRec
22  {
23  GLint sizeX, sizeY;
24  unsigned char *data;
25  };
26 
28  class CGLCellData : public CCellData
29  {
30  public:
31  CGLCellData(CellId cellId);
32  virtual ~CGLCellData();
33  public:
34  bool useIndex;
36  bool vboBuilt;
38  bool baked;
40  unsigned int vboVertices[MEDIUM_MAX];
42  unsigned int normalMap;
44  unsigned int texture;
46  unsigned int vboFaceIndices[MEDIUM_MAX];
48  unsigned int vboVertNormals[MEDIUM_MAX];
50  unsigned int vboFaceNormals[MEDIUM_MAX];
52  unsigned int vboTexCoords[MEDIUM_MAX];
56  unsigned int vboMaterials[MEDIUM_MAX];
58  unsigned int vboMaterialChannels[MEDIUM_MAX][3];
60  unsigned int vboLightColor[MEDIUM_MAX];
62  unsigned int vboLightDir[MEDIUM_MAX];
64  unsigned int vboBillboardVertices;
66  unsigned int vboBillboardNormals;
68  unsigned int vboBillboardLightColor;
70  unsigned int vboBillboardLightDir;
72  unsigned int vboBillboardSize;
74  unsigned int vboBillboardUV;
75 
76  unsigned int vboInstanceVertices;
77  unsigned int vboInstanceNormals;
78  unsigned int vboInstanceUV;
79  unsigned int vboInstanceFaces;
80 
81  unsigned int vboSeamVertices[MEDIUM_MAX][2][3];
82  unsigned int vboSeamVertNormals[MEDIUM_MAX][2][3];
83  unsigned int vboSeamFaceNormals[MEDIUM_MAX][2][3];
84  unsigned int vboSeamMaterials[MEDIUM_MAX][2][3];
85  unsigned int vboSeamLightColor[MEDIUM_MAX][2][3];
86 
87  public:
88  // Vertex attributes for main geometry
89  static const int VERT_POS_X = 2;
90  static const int VERT_POS_Y = 2;
91  static const int VERT_POS_Z = 2;
92  static const int VERT_POS_TYPE = 2;
93  static const int VERT_POS_SIZE = VERT_POS_X + VERT_POS_Y + VERT_POS_Z + VERT_POS_TYPE;
94  static const int VERT_NORMAL_OFFSET = VERT_POS_SIZE;
95  static const int VERT_NORMAL_FACE_X = 1;
96  static const int VERT_NORMAL_FACE_Z = 1;
97  static const int VERT_NORMAL_VERT_X = 1;
98  static const int VERT_NORMAL_VERT_Z = 1;
99  static const int VERT_NORMAL_SIZE = VERT_NORMAL_FACE_X + VERT_NORMAL_FACE_Z + VERT_NORMAL_VERT_X + VERT_NORMAL_VERT_Z;
100  static const int VERT_MATA_OFFSET = VERT_NORMAL_OFFSET + VERT_NORMAL_SIZE;
101  static const int VERT_MATA_ID0L = 1;
102  static const int VERT_MATA_ID0H = 1;
103  static const int VERT_MATA_ID1L = 1;
104  static const int VERT_MATA_ID1H = 1;
105  static const int VERT_MATA_SIZE = VERT_MATA_ID0L + VERT_MATA_ID0H + VERT_MATA_ID1L + VERT_MATA_ID1H;
106  static const int VERT_MATB_OFFSET = VERT_MATA_OFFSET + VERT_MATA_SIZE;
107  static const int VERT_MATB_ID2L = 1;
108  static const int VERT_MATB_ID2H = 1;
109  static const int VERT_MATB_A0 = 1;
110  static const int VERT_MATB_A1 = 1;
111  static const int VERT_MATB_SIZE = VERT_MATB_ID2L + VERT_MATB_ID2H + VERT_MATB_A0 + VERT_MATB_A1;
112  static const int VERT_COL_OFFSET = VERT_MATB_OFFSET + VERT_MATB_SIZE;
113  static const int VERT_COL_R = 1;
114  static const int VERT_COL_G = 1;
115  static const int VERT_COL_B = 1;
116  static const int VERT_COL_AMB = 1;
117  static const int VERT_COL_SIZE = VERT_COL_R + VERT_COL_G + VERT_COL_B + VERT_COL_AMB;
118  static const int VERT_SIZE = VERT_POS_SIZE + VERT_NORMAL_SIZE + VERT_MATA_SIZE + VERT_MATB_SIZE + VERT_COL_SIZE;
119  GLuint vboVertexInfo[MEDIUM_MAX];
120  char* vertexInfo[MEDIUM_MAX];
121  GLuint vboSeamVertexInfo[MEDIUM_MAX][2][3];
122  char* seamVertexInfo[MEDIUM_MAX][2][3];
123  public:
124  // Vertex attributes for billboards
125  static const int VERT_BB_POS_X = 1;
126  static const int VERT_BB_POS_Y = 1;
127  static const int VERT_BB_POS_Z = 1;
128  static const int VERT_BB_POS_RIGIDITY = 1;
129  static const int VERT_BB_POS_SIZE = VERT_BB_POS_X + VERT_BB_POS_Y + VERT_BB_POS_Z + VERT_BB_POS_RIGIDITY;
130  static const int VERT_BB_NORMAL_OFFSET = VERT_BB_POS_SIZE;
131  static const int VERT_BB_NORMAL_X = 1;
132  static const int VERT_BB_NORMAL_Z = 1;
133  static const int VERT_BB_SIZE_U = 1;
134  static const int VERT_BB_SIZE_V = 1;
135  static const int VERT_BB_NORMAL_SIZE = VERT_BB_NORMAL_X + VERT_BB_NORMAL_Z + VERT_BB_SIZE_U + VERT_BB_SIZE_V;
136  static const int VERT_BB_TEX_OFFSET = VERT_BB_NORMAL_OFFSET + VERT_BB_NORMAL_SIZE;
137  static const int VERT_BB_TEX_U = 2;
138  static const int VERT_BB_TEX_V = 2;
139  static const int VERT_BB_TEX_SIZE = VERT_BB_TEX_U + VERT_BB_TEX_V;
140  static const int VERT_BB_COL_OFFSET = VERT_BB_TEX_OFFSET + VERT_BB_TEX_SIZE;
141  static const int VERT_BB_COL_R = 1;
142  static const int VERT_BB_COL_G = 1;
143  static const int VERT_BB_COL_B = 1;
144  static const int VERT_BB_COL_L = 1;
145  static const int VERT_BB_COL_SIZE = VERT_BB_COL_R + VERT_BB_COL_G + VERT_BB_COL_B + VERT_BB_COL_L;
146  static const int VERT_BB_SIZE = VERT_BB_POS_SIZE + VERT_BB_NORMAL_SIZE + VERT_BB_TEX_SIZE + VERT_BB_COL_SIZE;
147  GLuint vboBillboardVertexInfo;
148  char* billboardVertexInfo;
149 
151  GLushort* faceIds[MEDIUM_MAX];
152  public:
153  void buildIndexedBuffers();
154  void packVertexInfo();
155  void packSeamVertexInfo(int medium, int axis, int front);
156  virtual void processMesh(CMaterialLibrary* materialLibrary, CBillboardCache* billboardCache, ThreadContext* tc, LODStats stats) override;
157  void processGL();
158  public:
160  bool occluded;
161  };
162 
164  extern GLuint glCellRenderProgram;
166  extern GLuint uniform_cellRenderProgram_fade;
168  extern GLuint uniform_cellRenderProgram_offset;
202  extern GLuint uniform_cellRenderProgram_LOD;
207  extern GLuint uniform_cellRenderProgram_shadowMapPhysics;
210  extern GLuint uniform_cellRenderProgram_sunDir;
211  extern GLuint uniform_cellRenderProgram_moonDir;
212  extern GLuint uniform_cellRenderProgram_sunColor;
213  extern GLuint uniform_cellRenderProgram_skyColor;
214  extern GLuint uniform_cellRenderProgram_ambColor1;
215  extern GLuint uniform_cellRenderProgram_ambColor2;
216  extern GLuint uniform_cellRenderProgram_ambBase;
217  extern GLuint uniform_cellRenderProgram_v3CameraPos;
218  extern GLuint uniform_cellRenderProgram_v3InvWavelength;
219  extern GLuint uniform_cellRenderProgram_fCameraHeight;
220  extern GLuint uniform_cellRenderProgram_fCameraHeight2;
221  extern GLuint uniform_cellRenderProgram_fOuterRadius;
222  extern GLuint uniform_cellRenderProgram_fOuterRadius2;
223  extern GLuint uniform_cellRenderProgram_fInnerRadius;
224  extern GLuint uniform_cellRenderProgram_fInnerRadius2;
225  extern GLuint uniform_cellRenderProgram_fKrESun;
226  extern GLuint uniform_cellRenderProgram_fKmESun;
227  extern GLuint uniform_cellRenderProgram_fKr4PI;
228  extern GLuint uniform_cellRenderProgram_fKm4PI;
229  extern GLuint uniform_cellRenderProgram_fScale;
230  extern GLuint uniform_cellRenderProgram_fScaleDepth;
231  extern GLuint uniform_cellRenderProgram_fScaleOverScaleDepth;
232  extern GLuint uniform_cellRenderProgram_g;
233  extern GLuint uniform_cellRenderProgram_g2;
234  extern GLuint uniform_cellRenderProgram_sceneHeightBounds;
235  extern GLuint uniform_cellRenderProgram_vertexPos;
236  extern GLuint uniform_cellRenderProgram_vertexNormals;
237  extern GLuint uniform_cellRenderProgram_vertexMaterialsA;
238  extern GLuint uniform_cellRenderProgram_vertexMaterialsB;
239  extern GLuint uniform_cellRenderProgram_vertexColor;
240 
241  extern GLuint uniform_cellRenderProgram_fragmentRot;
242 
244  extern GLuint glWaterProgram;
246  extern GLuint uniform_waterProgram_fade;
248  extern GLuint uniform_waterProgram_offset;
250  extern GLuint uniform_waterProgram_worldOffset;
252  extern GLuint uniform_waterProgram_relOffset;
254  extern GLuint uniform_waterProgram_cursorPos;
258  extern GLuint uniform_waterProgram_cursorPosMin;
260  extern GLuint uniform_waterProgram_cursorPosMax;
262  extern GLuint uniform_waterProgram_textures;
264  extern GLuint uniform_waterProgram_noiseTexture;
268  extern GLuint uniform_waterProgram_faceNormal;
276  extern GLuint uniform_waterProgram_lightDir;
278  extern GLuint uniform_waterProgram_cellSize;
280  extern GLuint uniform_waterProgram_snowHeight;
282  extern GLuint uniform_waterProgram_LOD;
284  extern GLuint uniform_waterProgram_viewerPos;
286  extern GLuint uniform_waterProgram_shadowMap;
288  extern GLuint uniform_waterProgram_skylightMap;
289  extern GLuint uniform_waterProgram_sunDir;
290  extern GLuint uniform_waterProgram_moonDir;
291  extern GLuint uniform_waterProgram_sunColor;
292  extern GLuint uniform_waterProgram_skyColor;
293  extern GLuint uniform_waterProgram_ambColor1;
294  extern GLuint uniform_waterProgram_ambColor2;
295  extern GLuint uniform_waterProgram_ambBase;
296  extern GLuint uniform_waterProgram_v3CameraPos;
297  extern GLuint uniform_waterProgram_v3InvWavelength;
298  extern GLuint uniform_waterProgram_fCameraHeight;
299  extern GLuint uniform_waterProgram_fCameraHeight2;
300  extern GLuint uniform_waterProgram_fOuterRadius;
301  extern GLuint uniform_waterProgram_fOuterRadius2;
302  extern GLuint uniform_waterProgram_fInnerRadius;
303  extern GLuint uniform_waterProgram_fInnerRadius2;
304  extern GLuint uniform_waterProgram_fKrESun;
305  extern GLuint uniform_waterProgram_fKmESun;
306  extern GLuint uniform_waterProgram_fKr4PI;
307  extern GLuint uniform_waterProgram_fKm4PI;
308  extern GLuint uniform_waterProgram_fScale;
309  extern GLuint uniform_waterProgram_fScaleDepth;
310  extern GLuint uniform_waterProgram_fScaleOverScaleDepth;
311  extern GLuint uniform_waterProgram_g;
312  extern GLuint uniform_waterProgram_g2;
313  extern GLuint uniform_waterProgram_sceneHeightBounds;
314  extern GLuint uniform_waterProgram_vertexPos;
315  extern GLuint uniform_waterProgram_vertexNormals;
316  extern GLuint uniform_waterProgram_vertexMaterialsA;
317  extern GLuint uniform_waterProgram_vertexMaterialsB;
318  extern GLuint uniform_waterProgram_vertexColor;
319  extern GLuint uniform_waterProgram_time;
320 
321 
323  extern GLuint glBillboardProgram;
325  extern GLuint uniform_billboardProgram_fade;
327  extern GLuint uniform_billboardProgram_time;
329  extern GLuint uniform_billboardProgram_texture;
331  extern GLuint uniform_billboardProgram_noise;
333  extern GLuint uniform_billboardProgram_camUp;
335  extern GLuint uniform_billboardProgram_camRight;
337  extern GLuint uniform_billboardProgram_offset;
339  extern GLuint uniform_billboardProgram_cellSize;
348  extern GLuint uniform_billboardProgram_v3CameraPos;
349  extern GLuint uniform_billboardProgram_sunDir;
350  extern GLuint uniform_billboardProgram_sunColor;
351  extern GLuint uniform_billboardProgram_skyColor;
352  extern GLuint uniform_billboardProgram_ambColor1;
353  extern GLuint uniform_billboardProgram_ambColor2;
354  extern GLuint uniform_billboardProgram_ambBase;
355  extern GLuint uniform_billboardProgram_v3InvWavelength;
356  extern GLuint uniform_billboardProgram_fCameraHeight;
357  extern GLuint uniform_billboardProgram_fCameraHeight2;
358  extern GLuint uniform_billboardProgram_fOuterRadius;
359  extern GLuint uniform_billboardProgram_fOuterRadius2;
360  extern GLuint uniform_billboardProgram_fInnerRadius;
361  extern GLuint uniform_billboardProgram_fInnerRadius2;
362  extern GLuint uniform_billboardProgram_fKrESun;
363  extern GLuint uniform_billboardProgram_fKmESun;
364  extern GLuint uniform_billboardProgram_fKr4PI;
365  extern GLuint uniform_billboardProgram_fKm4PI;
366  extern GLuint uniform_billboardProgram_fScale;
367  extern GLuint uniform_billboardProgram_fScaleDepth;
368  extern GLuint uniform_billboardProgram_fScaleOverScaleDepth;
369  extern GLuint uniform_billboardProgram_g;
370  extern GLuint uniform_billboardProgram_g2;
371  extern GLuint uniform_billboardProgram_sceneHeightBounds;
372 
373  extern GLuint uniform_billboardProgram_vertexPos;
374  extern GLuint uniform_billboardProgram_vertexNormal;
375  extern GLuint uniform_billboardProgram_vertexUV;
376  extern GLuint uniform_billboardProgram_vertexColor;
377 
379  extern GLuint glInstanceProgram;
381  extern GLuint uniform_instanceProgram_fade;
383  extern GLuint uniform_instanceProgram_time;
385  extern GLuint uniform_instanceProgram_texture;
387  extern GLuint uniform_instanceProgram_noise;
389  extern GLuint uniform_instanceProgram_camUp;
391  extern GLuint uniform_instanceProgram_camRight;
393  extern GLuint uniform_instanceProgram_offset;
395  extern GLuint uniform_instanceProgram_cellSize;
397  extern GLuint uniform_instanceProgram_viewerPos;
399  extern GLuint uniform_instanceProgram_shadowMap;
404  extern GLuint uniform_instanceProgram_sunDir;
405  extern GLuint uniform_instanceProgram_sunColor;
406  extern GLuint uniform_instanceProgram_skyColor;
407  extern GLuint uniform_instanceProgram_ambColor1;
408  extern GLuint uniform_instanceProgram_ambColor2;
409  extern GLuint uniform_instanceProgram_ambBase;
410 
412  extern GLuint glShadowCasterProgram;
413  extern GLuint uniform_shadowCasterProgram_vertexPos;
414 
416  extern GLuint glUICubeProgram;
418  extern GLuint uniform_UICubeProgram_textures;
419 
421  extern GLuint materialArray;
423  extern GLuint textureArray;
425  extern GLuint instanceTextureArray;
427  extern GLuint noiseTexture;
429  extern GLuint billboardTexture;
431  extern GLuint shadowDepthTextureId;
432  extern GLuint shadowDepthTextureIdPhysics;
434  extern GLuint skylightDepthTextureId;
435 
436  void computeOcclusion(Scene* scene, CClipmapView* clipmapView);
437 
439  void render(
441  Scene* scene,
443  Scene* prevScene,
445  float sceneBlend,
447  CClipmapView* clipmapView);
448 
450  void renderShadowCasters(
452  Scene* scene,
454  CClipmapView* clipmapView);
455 
456  // Sky properties
457  extern Algebra::Vector sunDir;
458  extern Algebra::Vector moonDir;
459  extern Algebra::Vector sunColor;
460  extern Algebra::Vector skyColor;
461  extern Algebra::Vector skyColorBillboards;
462  extern Algebra::Vector ambColor1;
463  extern Algebra::Vector ambColor2;
464  extern Algebra::Vector ambBase;
465  extern float planetRadius;
466  extern float atmosphereRadius;
467 
469  extern double lastShadowXpos;
471  extern double lastShadowYpos;
473  extern double lastShadowZpos;
474 
475  extern double lastShadowXposPhys;
476  extern double lastShadowYposPhys;
477  extern double lastShadowZposPhys;
478 
480  extern bool lineMode;
482  extern bool debugMode;
483  extern GLenum lastGLError;
484 
486  struct Plane
487  {
488  GLfloat a, b, c, d;
489  };
490 
492  struct Frustum
493  {
494  Plane left;
495  Plane right;
496  Plane bottom;
497  Plane top;
498  Plane nr;
499  Plane fr;
500  };
501  void extractFrustum(Frustum& f);
502  bool sphereInFrustum(Frustum& f, GLfloat x, GLfloat y, GLfloat z, GLfloat radius);
503 
504  class CSolid : public CGLCellData
505  {
506  public:
507  double transform[16];
508  };
509  }
510 }
511 
512 #define GL_CHECK
513 #ifdef GL_CHECK
514 inline void glErrorCheck()
515 {
516  GLenum error = glGetError();
517  if (error != GL_NO_ERROR && VoxelFarm::GL::lastGLError == 0)
518  {
519  VoxelFarm::GL::lastGLError = error;
520  /*
521  VoxelFarm::logstream << "OpenGL error: " << error << std::endl;
522  VoxelFarm::logstream.flush();
523  //__asm int 03
524  */
525  }
526 }
527 #else
528 inline void glErrorCheck() {}
529 #endif
GLuint uniform_cellRenderProgram_worldOffset
Shader parameter for the cell's offset based on the world coordinates when rendering started...
GLuint uniform_billboardProgram_camRight
Shader parameter for camera right direction vector.
unsigned int vboVertices[MEDIUM_MAX]
Vertex Buffer Object for the vertex array in the GPU.
Definition: glrender.h:40
bool baked
Indicates whether the Cell has been already processed and had its data moved to the GPU...
Definition: glrender.h:38
GLuint uniform_waterProgram_cursorHintPos
Shader parmeter for the add cursor coordinates.
virtual void processMesh(CMaterialLibrary *materialLibrary, CBillboardCache *billboardCache, ThreadContext *tc, LODStats stats) override
Computes normals, materials and billboards for the Cell.
unsigned int normalMap
Texture object for the normal map. Only used in the offline mode.
Definition: glrender.h:42
GLuint uniform_instanceProgram_time
Shader parameter for the current world time. This is used to animate wind.
unsigned int vboTexCoords[MEDIUM_MAX]
Vertex Buffer Object for the texture coordinates in the GPU.
Definition: glrender.h:52
GLuint uniform_cellRenderProgram_lightDir
Shader parameter for array of light incidence vectors.
GLuint uniform_waterProgram_materialArray
Shader parameter for Rectangle texture that packs material information for the shader.
GLuint uniform_instanceProgram_viewerPos
Shader parameter for current viewer position.
Contains all classes and functions for the VoxelFarm engine.
GLuint uniform_cellRenderProgram_faceNormal
Shader parameter for array of vertex normals. These normals are not smoothed.
unsigned int vboBillboardNormals
Vertex Buffer Object for the billboard normals in the GPU.
Definition: glrender.h:66
GLuint uniform_cellRenderProgram_relOffset
Shader parameter for the cell's relative offset to the viewer.
GLushort * faceIds[MEDIUM_MAX]
Face IDs.
Definition: glrender.h:151
GLuint glInstanceProgram
GLSL program ID for rendering instances.
Contains all materials available in the system.
unsigned int vboBillboardUV
Vertex Buffer Object for the billboard texture coordinates in the GPU.
Definition: glrender.h:74
A 3D Vector.
Definition: Vector.h:34
GLuint uniform_billboardProgram_camUp
Shader parameter for camera up direction vector.
GLuint uniform_cellRenderProgram_shadowMap
Shader parameter for the Sunlight shadow map.
GLuint uniform_cellRenderProgram_textures
Shader parameter for the material texture array.
GLuint textureArray
Texture Id for the material texture array.
GLuint uniform_billboardProgram_applyColor
Shader parameter for an array of colors used to colorize billboards.
unsigned int vboLightColor[MEDIUM_MAX]
Vertex Buffer Object for the light color in the GPU.
Definition: glrender.h:60
double lastShadowXpos
Last viewer X position for wich shadowing was computed.
unsigned int texture
Texture object for the diffuse map. Only used in the offline mode.
Definition: glrender.h:44
GLuint skylightDepthTextureId
Texture Id for the Skylight shadowmap.
static const int MEDIUM_MAX
Number of different mediums in the world. Each medium may be subject to a different rendering logic...
Definition: CellData.h:111
unsigned int vboNormalTexCoords[MEDIUM_MAX]
Vertex Buffer Object for the texture coordinates of the normal map in the GPU.
Definition: glrender.h:54
GLuint uniform_instanceProgram_cellSize
Shader parameter for the cell dimension.
GLuint uniform_billboardProgram_skylightMap
Shader parameter for the Skylight shadow map.
GLuint uniform_waterProgram_cellSize
Shader parameter for the cell dimension.
unsigned int vboBillboardLightColor
Vertex Buffer Object for the billboard colors in the GPU.
Definition: glrender.h:68
GLuint uniform_billboardProgram_shadowMap
Shader parameter for the Sunlight shadow map.
GLuint uniform_billboardProgram_offset
Shader parameter for the cell's absolute offset.
bool lineMode
Show lines instead of trianles.
GLuint noiseTexture
Texture Id for a pink noise texture array.
GLuint uniform_UICubeProgram_textures
Shader parameter for material texture array.
GLuint uniform_cellRenderProgram_cursorPosMax
Shader parmeter for the highest corner of the cursor scope.
unsigned int vboFaceIndices[MEDIUM_MAX]
Vertex Buffer Object for face indices.
Definition: glrender.h:46
GLuint glUICubeProgram
GLSL program ID for rendering material samples in the UI.
unsigned __int64 CellId
A 64bit integer that identifies a single world octree Cell.
Definition: mapindex.h:23
GLuint uniform_waterProgram_skylightMap
Shader parameter for the Skylight shadow map.
Cells Scene
A Scene is a set of cells.
Definition: scene.h:12
unsigned int vboMaterials[MEDIUM_MAX]
Vertex Buffer Object for the material array in the GPU.
Definition: glrender.h:56
Stores the information for a Cell that has already been converted to a polygonal mesh.
Definition: CellData.h:107
GLuint glWaterProgram
GLSL program ID for rendering water.
GLuint uniform_cellRenderProgram_materialChannelA
Shader parameter for channel A of vertex material data.
GLuint uniform_cellRenderProgram_LOD
Shader parameter for Level of Detail for the cell.
GLuint uniform_cellRenderProgram_cellSize
Shader parameter for the cell dimension.
unsigned int vboBillboardSize
Vertex Buffer Object for the billboard sizes in the GPU.
Definition: glrender.h:72
GLuint uniform_instanceProgram_texture
Shader parameter for the instance texture.
GLuint materialArray
Texture Id for the material information array.
GLuint uniform_waterProgram_snowHeight
Shader parameter for an absolute height value where snow starts to appear over materials.
GLuint uniform_cellRenderProgram_materialChannelC
Shader parameter for channel C of vertex material data.
GLuint uniform_waterProgram_materialChannelC
Shader parameter for channel C of vertex material data.
bool debugMode
Show lines instead of trianles.
GLuint uniform_instanceProgram_fade
Shader parameter to control fading effect for cell. This is used to smooth LOD transitions.
GLuint uniform_waterProgram_faceNormal
Shader parameter for array of vertex normals. These normals are not smoothed.
GLuint uniform_billboardProgram_noise
Shader parameter for a pink noise texture.
GLuint uniform_billboardProgram_fade
Shader parameter to control fading effect for cell. This is used to smooth LOD transitions.
GLuint uniform_billboardProgram_time
Shader parameter for the current world time. This is used to animate wind.
StatTracker LODStats[LEVELS][STAT_NULL]
Used to track stats across all LOD.
Definition: VoxelLayer.h:530
GLuint uniform_waterProgram_worldOffset
Shader parameter for the cell's offset based on the world coordinates when rendering started...
GLuint glShadowCasterProgram
GLSL program ID for rendering light occluders to the shadow maps.
double lastShadowYpos
Last viewer Y position for wich shadowing was computed.
GLuint uniform_cellRenderProgram_fade
Shader parameter to control fading effect for cell. This is used to smooth LOD transitions.
GLuint uniform_instanceProgram_camRight
Shader parameter for camera right direction vector.
GLuint uniform_billboardProgram_cellSize
Shader parameter for the cell dimension.
unsigned int vboLightDir[MEDIUM_MAX]
Vertex Buffer Object for the light direction in the GPU.
Definition: glrender.h:62
GLuint uniform_cellRenderProgram_cursorPos
Shader parmeter for the carve cursor coordinates.
GLuint uniform_billboardProgram_viewerPos
Shader parameter for current viewer position.
GLuint uniform_cellRenderProgram_cursorHintPos
Shader parmeter for the add cursor coordinates.
GLuint instanceTextureArray
Texture Id for the instance texture array.
GLuint uniform_waterProgram_offset
Shader parameter for the cell's absolute offset.
GLuint uniform_cellRenderProgram_offset
Shader parameter for the cell's absolute offset.
double lastShadowZpos
Last viewer Z position for wich shadowing was computed.
GLuint uniform_instanceProgram_camUp
Shader parameter for camera up direction vector.
GLuint uniform_waterProgram_cursorPos
Shader parmeter for the carve cursor coordinates.
unsigned int vboFaceNormals[MEDIUM_MAX]
Vertex Buffer Object for the face normals in the GPU.
Definition: glrender.h:50
A CellData object for rendering in OpenGL.
Definition: glrender.h:28
bool vboBuilt
Indicates whether the vertex buffer objects have been built.
Definition: glrender.h:36
Represents a moving view within a world. Computes new scenes as the view moves.
Definition: ClipmapView.h:65
GLuint uniform_cellRenderProgram_noiseTexture
Shader parameter for pink noise texture.
GLuint uniform_waterProgram_relOffset
Shader parameter for the cell's relative offset to the viewer.
Viewing Frustum.
Definition: glrender.h:492
void render(Scene *scene, Scene *prevScene, float sceneBlend, CClipmapView *clipmapView)
Renders the world. At any point in time, up to two different scenes could be active. This function will render a transition between the two scenes.
GLuint glCellRenderProgram
GLSL program ID for rendering world geometry.
GLuint uniform_instanceProgram_skylightMap
Shader parameter for the Skylight shadow map.
GLuint uniform_billboardProgram_texture
Shader parameter for the billboard texture.
GLuint uniform_waterProgram_viewerPos
Shader parameter for current viewer position.
GLuint uniform_waterProgram_cursorPosMin
Shader parmeter for the lower corner of the cursor scope.
GLuint uniform_instanceProgram_shadowMap
Shader parameter for the Sunlight shadow map.
GLuint uniform_cellRenderProgram_skylightMap
Shader parameter for the Skylight shadow map.
void renderShadowCasters(Scene *scene, CClipmapView *clipmapView)
Renders only the shadow casting elements in the world. This is used to create shadow maps by renderin...
GLuint uniform_instanceProgram_applyColor
Shader parameter for an array of colors used to colorize instances.
GLuint uniform_waterProgram_materialChannelA
Shader parameter for channel A of vertex material data.
GLuint uniform_waterProgram_lightDir
Shader parameter for array of light incidence vectors.
GLuint billboardTexture
Texture Id for the billboard texture atlas.
GLuint uniform_instanceProgram_noise
Shader parameter for a pink noise texture.
GLuint glBillboardProgram
GLSL program ID for rendering billboards.
GLuint shadowDepthTextureId
Texture Id for the Sunlight shadowmap.
unsigned int vboVertNormals[MEDIUM_MAX]
Vertex Buffer Object for the vertex normals in the GPU.
Definition: glrender.h:48
unsigned int vboBillboardLightDir
Vertex Buffer Object for the billboard light direction in the GPU.
Definition: glrender.h:70
GLuint uniform_waterProgram_cursorPosMax
Shader parmeter for the highest corner of the cursor scope.
GLuint uniform_instanceProgram_offset
Shader parameter for the cell's absolute offset.
GLuint uniform_waterProgram_fade
Shader parameter to control fading effect for cell. This is used to smooth LOD transitions.
A 3D plane used to extract Frustum.
Definition: glrender.h:486
GLuint uniform_waterProgram_LOD
Shader parameter for Level of Detail for the cell.
GLuint uniform_cellRenderProgram_viewerPos
Shader parameter for current viewer position.
GLuint uniform_waterProgram_noiseTexture
Shader parameter for pink noise texture.
GLuint uniform_waterProgram_materialChannelB
Shader parameter for channel B of vertex material data.
GLuint uniform_cellRenderProgram_materialChannelB
Shader parameter for channel B of vertex material data.
Keeps an billboard cache entry for each cell that had its billboards and material instances generated...
Definition: CellData.h:75
GLuint uniform_cellRenderProgram_materialArray
Shader parameter for Rectangle texture that packs material information for the shader.
unsigned int vboMaterialChannels[MEDIUM_MAX][3]
Vertex Buffer Object for the material array in the GPU.
Definition: glrender.h:58
unsigned int vboBillboardVertices
Vertex Buffer Object for the billboard vertices in the GPU.
Definition: glrender.h:64
GLuint uniform_cellRenderProgram_cursorPosMin
Shader parmeter for the lower corner of the cursor scope.
GLuint uniform_cellRenderProgram_snowHeight
Shader parameter for an absolute height value where snow starts to appear over materials.
GLuint uniform_waterProgram_shadowMap
Shader parameter for the Sunlight shadow map.
GLuint uniform_waterProgram_textures
Shader parameter for the material texture array.