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) 2023 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 
151  virtual bool allowSparseTiling() const;
152 
156  virtual void setTexture(DtTextureInterface* texture);
157 
159  virtual DtTextureInterface* texture() const;
160 
163  virtual bool pick(double x, double y, double z) const;
164 
165  protected:
166 
169  {
170  double x = 0.0f;
171  double y = 0.0f;
172  double z = 0.0f;
173  float u = 0.0f;
174  float v = 0.0f;
175  };
176 
179 
181  void setStagingPointFromVector(StagingPoint& outPoint, const DtVector& inPoint) const;
182 
185  virtual void computeTopoTransform(DtCoordTransform& geocToTopo,
186  DtVector& geocentricOrigin, const DtVector& localOrigin,
187  DtCoordinateSystem& coordinateSystem) const;
188 
191  virtual void updateProjectedUVCoordinates();
192 
197  virtual void computeDrawPasses();
198 
202  virtual void computeDrawPassBounds();
203 
210  virtual void computeProjectionRangeFromArea(float boundsSizeX, float boundsSizeY);
211 
216  void drawPassTransform(DtVector3<double>& origin, float* rotation) const;
217 
219  void drawPassBoundingSphere(DtVector3<float>& center, float& radius) const;
220 
221  // Returns the number of draw passes.
222  size_t drawPassCount() const;
223 
226  size_t passPointCount(unsigned int pass) const;
227 
231  const void* passPoints(unsigned int pass) const;
232 
235  const void* passPointsUVs(unsigned int pass) const;
236 
239  void passBounds(unsigned int pass, DtVector& boundsMin, DtVector& boundsMax);
240 
242  struct TopoPoint
243  {
244  float x = 0.0f;
245  float y = 0.0f;
246  float z = 0.0f;
247  float w = 1.0f;
248  };
249 
252  bool pickTriangles(const DtVector3<float>& localPoint) const;
253 
256  bool pickLines(const DtVector3<float>& localPoint, float radius) const;
257 
261  bool pointInTriangle(const DtVector3<float>& point,
264  const DtDecalProjectorComponent::TopoPoint pointC) const;
265 
269  float squaredDistanceToLine(const DtVector3<float>& point,
271  const DtDecalProjectorComponent::TopoPoint pointB) const;
272 
277  static void setPickLineRadius(float radius);
278 
279  protected:
280 
285  static float thePickLineRadius;
286 
289  {
290  size_t myPointCount = 0;
291  void* myPointDataStart = nullptr;
292  void* myPointUVsDataStart = nullptr;
295  };
296 
298 
302 
303  unsigned int myStipplePattern[32];
304  float myColor[4];
306 
309 
314 
317  float myDrawPassRotation[16];
320 
321  // 3D staging points local to the transform.
322  std::vector<StagingPoint> myStagingPoints;
323 
324  // Topographic points used for rendering.
325  std::vector<TopoPoint> myTopoPoints;
326  std::vector<TopoPoint> myTopoPointsUVs;
327 
328  std::vector<DrawPassData> myDrawPasses;
329  };
330 
331 
332 
335  {
336  public:
339 
342 
345  const DtDecalProjectorComponentCreator& other) = delete;
346 
349  const DtDecalProjectorComponentCreator& other) = delete;
350 
351  public:
353  virtual DtDecalProjectorComponent* create(DtDecalProjectorRenderer& renderer) const;
354 
358  static DtDecalProjectorComponentCreator& instance(DtDe& de);
359 
361  static const std::string& theClassName();
362  };
363 
364 }
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:168
bool myAutoProjectionRange
Definition: DtDecalProjectorComponent.h:301
float myProjectionRangeNear
Definition: DtDecalProjectorComponent.h:299
voidpf uLong int origin
Definition: ioapi.h:42
float myDrawPassBoundsRadius
Definition: DtDecalProjectorComponent.h:319
std::vector< DrawPassData > myDrawPasses
Definition: DtDecalProjectorComponent.h:328
A structure to hold data for a draw pass.
Definition: DtDecalProjectorComponent.h:288
voidpf void uLong size
Definition: ioapi.h:39
Interface for a texture. Used to pass in a texture to vrvGraphics.
Definition: DtTextureInterface.h:24
float myProjectionRangeFar
Definition: DtDecalProjectorComponent.h:300
DtVector3< float > myProjCoordsOrigin
Definition: DtDecalProjectorComponent.h:311
std::vector< StagingPoint > myStagingPoints
Definition: DtDecalProjectorComponent.h:322
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:285
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:316
#define DT_DLL_VRVGRAPHICS
Contains DLL export macros.
Definition: vrvGraphics.h:19
float myFillPatternFrequency
Definition: DtDecalProjectorComponent.h:305
std::vector< TopoPoint > myTopoPoints
Definition: DtDecalProjectorComponent.h:325
DtVector3< float > myProjCoordsAxisV
Definition: DtDecalProjectorComponent.h:313
Contains makVrv::DtQuat class.
A structure to hold data for 1 point.
Definition: DtDecalProjectorComponent.h:242
bool myAllowAltitudeTileMultiplier
Definition: DtDecalProjectorComponent.h:308
DtVector myBoundsMax
Definition: DtDecalProjectorComponent.h:294
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition: DtCoordinateSystem.h:40
creator for DtDecalProjectorComponent
Definition: DtDecalProjectorComponent.h:334
DtVector3< float > myDrawPassBoundsCenter
Definition: DtDecalProjectorComponent.h:318
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:326
bool myUseProjectedTextureCoordinates
Definition: DtDecalProjectorComponent.h:310
Contains the makVrv::DtDecalProjectorComponentInterface class declaration.
DtTextureInterface * myTexture
Definition: DtDecalProjectorComponent.h:307
DtVector myBoundsMin
Definition: DtDecalProjectorComponent.h:293
DtVector3< float > myProjCoordsAxisU
Definition: DtDecalProjectorComponent.h:312
DtDecalProjectorRenderer & myRenderer
Definition: DtDecalProjectorComponent.h:297
DtVector myDrawPassOrigin
Definition: DtDecalProjectorComponent.h:315

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)