VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDecalProjectorComponent.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2024 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
14 
16 
17 #include <vrvMath/DtVector3.h>
18 
20 #include <vrvUtil/DtQuat.h>
21 
22 #include <matrix/coordTransform.h>
23 #include <matrix/vlVector.h>
24 
25 #include <vector>
26 
27 
28 namespace makVrv
29 {
30 
31  class DtCoordinateSystem;
32  class DtDecalProjectorRenderer;
33  class DtDe;
34  struct DtObserverRenderData;
35  struct DtOverlayRenderData;
36  class DtOverlayResourceProvider;
37  class DtPrimitiveStyle;
38  class DtTextureInterface;
39 
40 
60  {
61  public:
62 
66 
68  virtual ~DtDecalProjectorComponent();
69 
77  virtual void setProjectionRange(float projNear, float projFar);
78 
81  virtual void projectionRange(float& projNear, float& projFar) const;
82 
84  virtual void resizeStagingVertexCount(size_t size);
85 
87  virtual void setStagingVertexPosition(unsigned int index, double x, double y, double z);
88 
91  virtual void expandStagingPointsToLines();
92 
97  virtual void expandStagingPointsToLineQuads(float lineWidth);
98 
102  virtual void stagingGeometryUpdated();
103 
105  virtual void setColor(float r, float g, float b, float a);
106 
108  virtual void getColor(float& r, float& g, float& b, float& a) const;
109 
115  virtual void projectUVCoordinates(const DtVector& origin,
116  const DtVector& axisU, const DtVector& axisV);
117 
118  virtual void getUVCoordinateProjection(DtVector3<float>& origin,
119  DtVector3<float>& axisU, DtVector3<float>& axisV) const;
120 
122  virtual void setStipplePattern(unsigned int stipplePattern[32] = 0);
123 
125  virtual const unsigned int* getStipplePattern() const;
126 
132  virtual void setFillPatternFrequency(float frequency) override;
133 
135  virtual float fillPatternFrequency() const override;
136 
140  virtual void setAllowAltitudeTileMultiplier(bool allow);
141 
145  virtual bool allowAltitudeTileMultiplier() const;
146 
149  virtual bool hasTileRate() const;
150 
153  virtual void setTileRate(float tileRate);
154 
156  virtual float tileRate() const;
157 
162  virtual bool allowSparseTiling() const;
163 
167  virtual void setTexture(DtTextureInterface* texture);
168 
170  virtual DtTextureInterface* texture() const;
171 
174  virtual bool pick(double x, double y, double z) const;
175 
176  protected:
177 
180  {
181  double x = 0.0f;
182  double y = 0.0f;
183  double z = 0.0f;
184  float u = 0.0f;
185  float v = 0.0f;
186  };
187 
190 
192  void setStagingPointFromVector(StagingPoint& outPoint, const DtVector& inPoint) const;
193 
196  virtual void computeTopoTransform(DtCoordTransform& geocToTopo,
197  DtVector& geocentricOrigin, const DtVector& localOrigin,
198  DtCoordinateSystem& coordinateSystem) const;
199 
202  virtual void updateProjectedUVCoordinates();
203 
208  virtual void computeDrawPasses();
209 
213  virtual void computeDrawPassBounds();
214 
221  virtual void computeProjectionRangeFromArea(float boundsSizeX, float boundsSizeY);
222 
227  void drawPassTransform(DtVector3<double>& origin, float* rotation) const;
228 
230  void drawPassBoundingSphere(DtVector3<float>& center, float& radius) const;
231 
232  // Returns the number of draw passes.
233  size_t drawPassCount() const;
234 
237  size_t passPointCount(unsigned int pass) const;
238 
242  const void* passPoints(unsigned int pass) const;
243 
246  const void* passPointsUVs(unsigned int pass) const;
247 
252  void passBounds(unsigned int pass, DtVector& boundsMin, DtVector& boundsMax);
253 
255  struct TopoPoint
256  {
257  float x = 0.0f;
258  float y = 0.0f;
259  float z = 0.0f;
260  float w = 1.0f;
261  };
262 
265  bool pickTriangles(const DtVector3<float>& localPoint) const;
266 
269  bool pickLines(const DtVector3<float>& localPoint, float radius) const;
270 
274  bool pointInTriangle(const DtVector3<float>& point,
277  const DtDecalProjectorComponent::TopoPoint pointC) const;
278 
282  float squaredDistanceToLine(const DtVector3<float>& point,
284  const DtDecalProjectorComponent::TopoPoint pointB) const;
285 
290  static void setPickLineRadius(float radius);
291 
292  protected:
293 
298  static float thePickLineRadius;
299 
302  {
303  size_t myPointCount = 0;
304  void* myPointDataStart = nullptr;
305  void* myPointUVsDataStart = nullptr;
306  DtVector myBoundsMin;
307  DtVector myBoundsMax;
308  };
309 
311 
315 
317  float myTileRate;
318 
319  unsigned int myStipplePattern[32];
320  float myColor[4];
322 
325 
330 
333  float myDrawPassRotation[16];
336 
337  // 3D staging points local to the transform.
338  std::vector<StagingPoint> myStagingPoints;
339 
340  // Topographic points used for rendering.
341  std::vector<TopoPoint> myTopoPoints;
342  std::vector<TopoPoint> myTopoPointsUVs;
343 
344  std::vector<DrawPassData> myDrawPasses;
345  };
346 
347 
348 
351  {
352  public:
355 
358 
361  const DtDecalProjectorComponentCreator& other) = delete;
362 
365  const DtDecalProjectorComponentCreator& other) = delete;
366 
367  public:
369  virtual DtDecalProjectorComponent* create(DtDecalProjectorRenderer& renderer) const;
370 
374  static DtDecalProjectorComponentCreator& instance(DtDe& de);
375 
377  static const std::string& theClassName();
378  };
379 
380 }
A class responsible for rendering decal projectors for a camera context.
Definition: DtDecalProjectorRenderer.h:93
A class responsible for rendering line decal projectors for a camera context.
Definition: DtDecalProjectorLineRenderer.h:33
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
A structure to hold data for 1 point.
Definition: DtDecalProjectorComponent.h:179
bool myAutoProjectionRange
Definition: DtDecalProjectorComponent.h:314
float myProjectionRangeNear
Definition: DtDecalProjectorComponent.h:312
voidpf uLong int origin
Definition: ioapi.h:42
float myDrawPassBoundsRadius
Definition: DtDecalProjectorComponent.h:335
std::vector< DrawPassData > myDrawPasses
Definition: DtDecalProjectorComponent.h:344
A structure to hold data for a draw pass.
Definition: DtDecalProjectorComponent.h:301
voidpf void uLong size
Definition: ioapi.h:39
bool myHasTileRate
Definition: DtDecalProjectorComponent.h:316
Interface for a texture. Used to pass in a texture to vrvGraphics.
Definition: DtTextureInterface.h:26
float myProjectionRangeFar
Definition: DtDecalProjectorComponent.h:313
DtVector3< float > myProjCoordsOrigin
Definition: DtDecalProjectorComponent.h:327
std::vector< StagingPoint > myStagingPoints
Definition: DtDecalProjectorComponent.h:338
3 dimensional vector
static float thePickLineRadius
This is used as the physical line radius (in meters) when computing if a line was picked or not durin...
Definition: DtDecalProjectorComponent.h:298
A class which represents a component for a decal projector.
Definition: DtDecalProjectorComponent.h:59
A class which represents a component for a decal projector.
Definition: DtDecalProjectorComponentInterface.h:43
DtQuat myDrawPassRotationInvQuat
Definition: DtDecalProjectorComponent.h:332
#define DT_DLL_VRVGRAPHICS
Contains DLL export macros.
Definition: vrvGraphics.h:19
float myFillPatternFrequency
Definition: DtDecalProjectorComponent.h:321
std::vector< TopoPoint > myTopoPoints
Definition: DtDecalProjectorComponent.h:341
DtVector3< float > myProjCoordsAxisV
Definition: DtDecalProjectorComponent.h:329
Contains makVrv::DtQuat class.
A structure to hold data for 1 point.
Definition: DtDecalProjectorComponent.h:255
bool myAllowAltitudeTileMultiplier
Definition: DtDecalProjectorComponent.h:324
float myTileRate
Definition: DtDecalProjectorComponent.h:317
DtVector myBoundsMax
Definition: DtDecalProjectorComponent.h:307
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition: DtCoordinateSystem.h:40
creator for DtDecalProjectorComponent
Definition: DtDecalProjectorComponent.h:350
DtVector3< float > myDrawPassBoundsCenter
Definition: DtDecalProjectorComponent.h:334
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
A utility Quaternion class.
Definition: DtQuat.h:19
std::vector< TopoPoint > myTopoPointsUVs
Definition: DtDecalProjectorComponent.h:342
bool myUseProjectedTextureCoordinates
Definition: DtDecalProjectorComponent.h:326
Contains the makVrv::DtDecalProjectorComponentInterface class declaration.
DtTextureInterface * myTexture
Definition: DtDecalProjectorComponent.h:323
DtVector myBoundsMin
Definition: DtDecalProjectorComponent.h:306
DtVector3< float > myProjCoordsAxisU
Definition: DtDecalProjectorComponent.h:328
DtDecalProjectorRenderer & myRenderer
Definition: DtDecalProjectorComponent.h:310
DtVector myDrawPassOrigin
Definition: DtDecalProjectorComponent.h:331

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)