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 
250  void passBounds(unsigned int pass, DtVector& boundsMin, DtVector& boundsMax);
251 
253  struct TopoPoint
254  {
255  float x = 0.0f;
256  float y = 0.0f;
257  float z = 0.0f;
258  float w = 1.0f;
259  };
260 
263  bool pickTriangles(const DtVector3<float>& localPoint) const;
264 
267  bool pickLines(const DtVector3<float>& localPoint, float radius) const;
268 
272  bool pointInTriangle(const DtVector3<float>& point,
275  const DtDecalProjectorComponent::TopoPoint pointC) const;
276 
280  float squaredDistanceToLine(const DtVector3<float>& point,
282  const DtDecalProjectorComponent::TopoPoint pointB) const;
283 
288  static void setPickLineRadius(float radius);
289 
290  protected:
291 
296  static float thePickLineRadius;
297 
300  {
301  size_t myPointCount = 0;
302  void* myPointDataStart = nullptr;
303  void* myPointUVsDataStart = nullptr;
306  };
307 
309 
313 
315  float myTileRate;
316 
317  unsigned int myStipplePattern[32];
318  float myColor[4];
320 
323 
328 
331  float myDrawPassRotation[16];
334 
335  // 3D staging points local to the transform.
336  std::vector<StagingPoint> myStagingPoints;
337 
338  // Topographic points used for rendering.
339  std::vector<TopoPoint> myTopoPoints;
340  std::vector<TopoPoint> myTopoPointsUVs;
341 
342  std::vector<DrawPassData> myDrawPasses;
343  };
344 
345 
346 
349  {
350  public:
353 
356 
359  const DtDecalProjectorComponentCreator& other) = delete;
360 
363  const DtDecalProjectorComponentCreator& other) = delete;
364 
365  public:
367  virtual DtDecalProjectorComponent* create(DtDecalProjectorRenderer& renderer) const;
368 
372  static DtDecalProjectorComponentCreator& instance(DtDe& de);
373 
375  static const std::string& theClassName();
376  };
377 
378 }
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:312
float myProjectionRangeNear
Definition: DtDecalProjectorComponent.h:310
voidpf uLong int origin
Definition: ioapi.h:42
float myDrawPassBoundsRadius
Definition: DtDecalProjectorComponent.h:333
std::vector< DrawPassData > myDrawPasses
Definition: DtDecalProjectorComponent.h:342
A structure to hold data for a draw pass.
Definition: DtDecalProjectorComponent.h:299
voidpf void uLong size
Definition: ioapi.h:39
bool myHasTileRate
Definition: DtDecalProjectorComponent.h:314
Interface for a texture. Used to pass in a texture to vrvGraphics.
Definition: DtTextureInterface.h:24
float myProjectionRangeFar
Definition: DtDecalProjectorComponent.h:311
DtVector3< float > myProjCoordsOrigin
Definition: DtDecalProjectorComponent.h:325
std::vector< StagingPoint > myStagingPoints
Definition: DtDecalProjectorComponent.h:336
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:296
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:330
#define DT_DLL_VRVGRAPHICS
Contains DLL export macros.
Definition: vrvGraphics.h:19
float myFillPatternFrequency
Definition: DtDecalProjectorComponent.h:319
std::vector< TopoPoint > myTopoPoints
Definition: DtDecalProjectorComponent.h:339
DtVector3< float > myProjCoordsAxisV
Definition: DtDecalProjectorComponent.h:327
Contains makVrv::DtQuat class.
A structure to hold data for 1 point.
Definition: DtDecalProjectorComponent.h:253
bool myAllowAltitudeTileMultiplier
Definition: DtDecalProjectorComponent.h:322
float myTileRate
Definition: DtDecalProjectorComponent.h:315
DtVector myBoundsMax
Definition: DtDecalProjectorComponent.h:305
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition: DtCoordinateSystem.h:40
creator for DtDecalProjectorComponent
Definition: DtDecalProjectorComponent.h:348
DtVector3< float > myDrawPassBoundsCenter
Definition: DtDecalProjectorComponent.h:332
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:72
A utility Quaternion class.
Definition: DtQuat.h:19
std::vector< TopoPoint > myTopoPointsUVs
Definition: DtDecalProjectorComponent.h:340
bool myUseProjectedTextureCoordinates
Definition: DtDecalProjectorComponent.h:324
Contains the makVrv::DtDecalProjectorComponentInterface class declaration.
DtTextureInterface * myTexture
Definition: DtDecalProjectorComponent.h:321
DtVector myBoundsMin
Definition: DtDecalProjectorComponent.h:304
DtVector3< float > myProjCoordsAxisU
Definition: DtDecalProjectorComponent.h:326
DtDecalProjectorRenderer & myRenderer
Definition: DtDecalProjectorComponent.h:308
DtVector myDrawPassOrigin
Definition: DtDecalProjectorComponent.h:329

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)