VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtTileSpaceLightGrid.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
13 
14 #pragma warning( push )
15 #pragma warning( disable : 4251 )
16 
17 // the maximum number if lights supported, this is limited by constant buffer size,
18 // commonly this is 64kb, but AMD only seem to allow 2048 lights...
19 #define NUM_POSSIBLE_LIGHTS (1024)
20 
21 // Must be a power of two, configure to suit hardware/wishes, also limited at
22 // runtime by glGet GL_MAX_COLOR_TEXTURE_SAMPLES. The smaller value is used.
23 #define MAX_ALLOWED_MSAA_SAMPLES 16
24 
26 #include "DtForwardDeclare.h"
28 #include <vrvGraphicsUtils/DtVector2.h>
29 #include "DtScreenRect.h"
30 #include "DtIntSize.h"
31 
32  namespace makVrv {
33 
34  typedef std::vector<uint32> VectorAreas;
35 
39  {
40  public:
43 
45  virtual ~DtTileSpaceLightGrid();
46 
48 
49  void setTileSize(const Vector2_uint32& tileSize);
50  const Vector2_uint32& tileSize(void) const;
52 
53 
55  const Vector2_uint32& gridMaxDims(void) const;
57  uint32 getGridMaxDimsFlattened(void) const;
58 
59 
61 
62  void update(const VectorLights& frustumVisibleLights
63  , const Camera_64* pCamera
64  , const Vector2_uint32& viewportSize);
65 
66  void update(const VectorLights& frustumVisibleLights
67  , const Matrix4_64& view_projection_matrix
68  , const Vector2_uint32& viewportSize);
70 
71 
73 
74  int tileLightCount(uint32 x, uint32 y) const;
75  const int *tileLightIndexList(uint32 x, uint32 y) const;
77 
78 
79 
81 
82  const int *tileDataPtr() const
83  {
84  return myGridOffsets;
85  }
86  const int *tileCountsDataPtr() const
87  {
88  return myGridCounts;
89  }
90  const int *tileLightIndexListsPtr() const
91  {
92  return &myTileLightIndexLists[0];
93  }
94 
95  uint32 totalTileLightIndexListLength() const
96  {
97  return uint32(myTileLightIndexLists.size());
98  }
100 
101 
103 
104  void setScreenAreaCullSize(uint32 val);
105  uint32 screenAreaCullSize(void) const;
107 
108  private:
109  void updateScreenSpaceRectangles(const VectorLights& frustumVisibleLights
110  , const Matrix4_64& view_projection_matrix
111  , const Vector2_uint32& viewportSize
112  , const Vector2_uint32& tileSize);
113 
115 
116 #if 0
117  const Vector2_32 getTileMinMax(uint32 x, uint32 y) const
118  {
119  return m_minMaxGridValid ?
120  m_gridMinMaxZ[x + y * m_gridDim.x]
121  : chag::make_vector(0.0f, 0.0f);
122  }
123  std::vector<chag::float2> m_gridMinMaxZ;
124 #endif
125 
128  void updateToAccountForScreenRes(const Vector2_uint32& viewport_size);
129 
131 
134 
135  std::vector<int> myTileLightIndexLists;
137 
138  ConstVectorLights myViewSpaceLights;
140 
142 
143  inline int& GridOffset(int x, int y)
144  {
145  return myGridOffsets[x + y * myGridMaxDims.x];
146  }
147  inline int& GridCount(int x, int y)
148  {
149  return myGridCounts[x + y * myGridMaxDims.x];
150  }
151 
153  };
154 
155 } //namespace makVrv
156 
157 #pragma warning(pop)

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)