VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDecalProjectorRenderer.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
13 
14 #include <vrvMath/DtCamera.h>
16 #include <vrvMath/DtMatrix4.h>
17 #include <vrvMath/DtVector4.h>
18 
21 
22 #include <matrix/vlMath.h>
23 #include <matrix/vlVector.h>
24 
25 #include <string>
26 
27 namespace makVrv
28 {
29  class DtCoordinateSystem;
30  class DtDe;
31  class DtBufferObject;
32  class DtGlBuffer;
33  class DtGlProgram;
34  class DtGlRenderTexture;
35  class DtDecalProjectorRenderer;
36  class DtDecalProjectorComponent;
37  class DtOverlayResourceProvider;
38  class DtTextureInterface;
39 
40 
44  {
47  float myCameraFrustum[6]; // left, right, top, bottom, camNear, camFar
51  float myViewport[4]; // x, y, width, height
52  double myObserverAltitude = 0.0;
53  bool myObserverIs2D = false;
55  };
56 
59 
61  template <>
62  inline const char* creatorTypeName<DtDecalProjectorRenderer>(void) { return "DtDecalProjectorRendererCreator"; }
63 
94  {
96 
97  public:
98 
99  virtual ~DtDecalProjectorRenderer();
100 
102  DtDecalProjectorRenderer() = delete;
103 
106  const DtDecalProjectorRenderer &other) = delete;
107 
109  DtDecalProjectorRenderer &operator=(
110  const DtDecalProjectorRenderer &other) = delete;
111 
112  public:
113 
115  virtual void releaseResources();
116 
118  virtual void releaseShaderResources();
119 
121  virtual DtCoordinateSystem* findCoordinateSystem();
122 
124  virtual const unsigned int maxDrawPassPoints() const;
125 
128  virtual const unsigned int topologyPointCount() const;
129 
132  virtual bool cull(const DtDecalProjectorRendererDrawSettings& drawSettings);
133 
135  virtual void draw(const DtDecalProjectorRendererDrawSettings& drawSettings);
136 
142  virtual DtDecalProjectorComponent* createComponent();
143 
148  virtual void registerComponent(DtDecalProjectorComponent* component);
149 
152  virtual void unregisterComponent(DtDecalProjectorComponent* component);
153 
155  virtual size_t registeredComponentCount() const;
156 
157  protected:
158 
162 
164  virtual bool initializeShaders();
165 
169  virtual void initializeBox();
170 
176  virtual int evaluateAabbVsSphere(
177  const DtVector3<double>& boxCenter, const DtVector3<double>& boxExtent,
178  const DtVector3<double>& sphereCenter, const double sphereRadius) const;
179 
182  virtual bool isCameraOutsideBox(
183  const DtVector3<double>& camPos, const float camFrustum[6],
184  const DtVector3<double>& boxPos,
185  const DtMatrix4<float>& boxRot,
186  const DtVector3<float>& boxOffset,
187  const DtVector3<float>& boxSize) const;
188 
195  virtual unsigned int setStipple(const unsigned int stipplePattern[32],
196  DtOverlayResourceProvider* resourceProvider, unsigned int lastSetTextureId);
197 
207  virtual unsigned int setTexture(DtTextureInterface* textureId,
208  DtOverlayResourceProvider* resourceProvider, unsigned int lastSetTextureId);
209 
212  virtual unsigned int computeStipplePatternSortId(const unsigned int pattern[32]);
213 
215  virtual void slot_coordinateSystemChanged();
216 
218  virtual void slot_reloadShaders();
219 
224  {
226  : myTextureInterface(nullptr)
227  , myStippleSortId(0)
228  , myComponent(nullptr)
229  {
230  // intentional noop
231  }
232 
233  DrawItemInfo(DtTextureInterface* textureInterface,
234  unsigned int stippleSortId, DtDecalProjectorComponent* component)
235  : myTextureInterface(textureInterface)
236  , myStippleSortId(stippleSortId)
237  , myComponent(component)
238  {
239  // intentional noop
240  }
241 
243  unsigned int myStippleSortId;
245  };
246 
248  static bool theSortByMaterial(const DrawItemInfo& arg0, const DrawItemInfo& arg1);
249 
250  protected:
251 
255  const static unsigned int thePointsMax = 192;
256 
258 
261  DtCoordinateSystem* myCoordinateSystem = nullptr;
262 
264 
265  bool myEnabled;
267 
270 
272 
277 
290 
291  typedef std::map<std::string, unsigned int> TextureMap;
294 
296  struct StippleKey
297  {
298  unsigned int key[32];
299  bool operator<(const StippleKey& b) const;
300  };
301 
305  typedef std::map<StippleKey, unsigned int> StippleMap;
307  unsigned int myNextStippleSortId;
308 
309  std::vector<DtDecalProjectorComponent*> myComponents;
310  std::vector<DrawItemInfo> myDrawItems;
311 
313 
314  };
315 }
int myShaderUboPointsBinding
Definition: DtDecalProjectorRenderer.h:275
DtMatrix4< float > myProjMat
Definition: DtDecalProjectorRenderer.h:49
double myObserverAltitude
Definition: DtDecalProjectorRenderer.h:52
int myShaderUboPointsUVsBinding
Definition: DtDecalProjectorRenderer.h:276
TextureMap myTextureMap
Definition: DtDecalProjectorRenderer.h:292
A class responsible for rendering decal projectors for a camera context.
Definition: DtDecalProjectorRenderer.h:93
DrawItemInfo(DtTextureInterface *textureInterface, unsigned int stippleSortId, DtDecalProjectorComponent *component)
Definition: DtDecalProjectorRenderer.h:233
std::vector< DtDecalProjectorComponent * > myComponents
Definition: DtDecalProjectorRenderer.h:309
int myUnfmLocPersMatrixReverseZ
Definition: DtDecalProjectorRenderer.h:288
DtDecalProjectorComponent * myComponent
Definition: DtDecalProjectorRenderer.h:244
DtBufferObject * myShaderUboPointsUVs
Definition: DtDecalProjectorRenderer.h:274
const char * creatorTypeName< DtDecalProjectorRenderer >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtDecalProjectorRenderer.h:62
std::map< std::string, unsigned int > TextureMap
Definition: DtDecalProjectorRenderer.h:291
std::string myFragmentShaderFileName
Definition: DtDecalProjectorRenderer.h:269
This is a std::map key for a stipple pattern.
Definition: DtDecalProjectorRenderer.h:296
A class the wraps a OpenGL Array Buffer object.
Definition: DtBufferObject.h:17
A structure used to pass draw settings to the draw method. All matrix order is Row Major coming from ...
Definition: DtDecalProjectorRenderer.h:43
Interface for a texture. Used to pass in a texture to vrvGraphics.
Definition: DtTextureInterface.h:24
DtDe & myDe
Definition: DtDecalProjectorRenderer.h:257
DtSignalConnectionManager myConnections
Definition: DtDecalProjectorRenderer.h:312
int myUnfmLocColor
Definition: DtDecalProjectorRenderer.h:286
4 dimensional vector
int myUnfmLocClipBoxCenter
Definition: DtDecalProjectorRenderer.h:283
A convenience class to represent an OpenGL Shader Program.
Definition: DtGlProgram.h:66
DtMatrix4< float > myCameraRot
Definition: DtDecalProjectorRenderer.h:46
int myUnfmLocViewport
Definition: DtDecalProjectorRenderer.h:289
Camera forward declarations.
A class which represents a component for a decal projector.
Definition: DtDecalProjectorComponent.h:59
DtGlProgram * myGlProgram
Definition: DtDecalProjectorRenderer.h:271
float myViewport[4]
Definition: DtDecalProjectorRenderer.h:51
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
The overlay resource provider class provides resources for overlay drawing classes.
Definition: DtOverlayResourceProvider.h:28
float myClipBoxExpand
Definition: DtDecalProjectorRenderer.h:266
#define DT_DLL_VRVGRAPHICS
Contains DLL export macros.
Definition: vrvGraphics.h:19
DtTextureInterface * myTextureInterface
Definition: DtDecalProjectorRenderer.h:242
friend DtDecalProjectorRendererCreator
Definition: DtDecalProjectorRenderer.h:95
std::string myVertexShaderFileName
Definition: DtDecalProjectorRenderer.h:268
unsigned int myStippleSortId
Definition: DtDecalProjectorRenderer.h:243
float myMaxTextureAnisotropy
Definition: DtDecalProjectorRenderer.h:293
int myUnfmLocModelViewMatrix
Definition: DtDecalProjectorRenderer.h:278
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
DtVector3< double > myCameraPos
Definition: DtDecalProjectorRenderer.h:45
int myUnfmLocClipBoxRot
Definition: DtDecalProjectorRenderer.h:282
int myUnfmLocPointCount
Definition: DtDecalProjectorRenderer.h:285
bool myEnabled
Definition: DtDecalProjectorRenderer.h:265
DtOverlayResourceProvider * myResourceProvider
Definition: DtDecalProjectorRenderer.h:54
Frustum_64 myFrustum
Definition: DtDecalProjectorRenderer.h:48
int myUnfmLocCoordTileRate
Definition: DtDecalProjectorRenderer.h:287
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition: DtCoordinateSystem.h:40
DtBufferObject * myBufferObject
Definition: DtDecalProjectorRenderer.h:263
int myUnfmLocProjectionMatrix
Definition: DtDecalProjectorRenderer.h:279
Base class to provide boost signal/slot management.
StippleMap myStippleMap
Definition: DtDecalProjectorRenderer.h:306
std::map< StippleKey, unsigned int > StippleMap
This is a map that contains stipple pattern id&#39;s used with draw items for faster material sorting...
Definition: DtDecalProjectorRenderer.h:305
std::vector< DrawItemInfo > myDrawItems
Definition: DtDecalProjectorRenderer.h:310
int myUnfmLocClipBoxPos
Definition: DtDecalProjectorRenderer.h:281
Camera class.
A sructure to hold information for a component that will be rendered. Using a structure allows extra ...
Definition: DtDecalProjectorRenderer.h:223
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
int myUnfmLocClipBoxSize
Definition: DtDecalProjectorRenderer.h:284
int myUnfmLocProjectionMatrixInv
Definition: DtDecalProjectorRenderer.h:280
float myCameraFrustum[6]
Definition: DtDecalProjectorRenderer.h:47
DtMatrix4< float > myProjMatI
Definition: DtDecalProjectorRenderer.h:50
DtBufferObject * myShaderUboPoints
Definition: DtDecalProjectorRenderer.h:273
bool myObserverIs2D
Definition: DtDecalProjectorRenderer.h:53
DtVirtualBaseClassCreator< DtDecalProjectorRenderer > DtDecalProjectorRendererCreator
creator
Definition: DtDecalProjectorRenderer.h:58
unsigned int myNextStippleSortId
Definition: DtDecalProjectorRenderer.h:307
4 dimensional matrix
DrawItemInfo()
Definition: DtDecalProjectorRenderer.h:225

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)