VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtAttachableEllipsoidArcModelInstance.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 <osg/MatrixTransform>
15 #include <osg/Geometry>
16 
18 
19 namespace makVrv
20 {
21 
25  {
26  public:
27 
30 
33  struct SphericalVertex {
34 
40  SphericalVertex(double _inclination, double _azimuth, double _radius);
41 
45  SphericalVertex(const osg::Vec3& cartesian);
46 
52  bool operator < (const SphericalVertex& rhs) const;
53 
57  osg::Vec3 toCartesian() const;
58 
60  double myInclination;
61 
63  double myAzimuth;
64 
66  double myRadius;
67 
68  };
69 
72  struct VertexCache
73  {
74 
81  VertexCache(osg::Vec3Array* vertices, osg::Vec3Array* normals);
82 
90  int getIndex(const SphericalVertex& vertex);
91 
93  typedef std::map<SphericalVertex, int> SphericalToIndexMap;
94 
97 
99  osg::Vec3Array* myVertices;
100 
102  osg::Vec3Array* myNormals;
103 
106 
107  };
108 
112  {
113 
120  SphericalQuad(const SphericalVertex& _topLeft, const SphericalVertex& _topRight,
121  const SphericalVertex& _bottomLeft, const SphericalVertex& _bottomRight);
122 
127 
128  };
129 
132  struct Triangle {
133 
139  Triangle(const SphericalVertex& _v1, const SphericalVertex& _v2, const SphericalVertex& _v3);
140 
144 
145  };
146 
149 
152  : center(0)
153  , sweep(0)
154  {}
155 
157  EllipsoidArcRange(float _center, float _sweep)
158  {
159  set(_center, _sweep);
160  }
161 
163  inline void set(float _center, float _sweep)
164  {
165  center = _center;
166  sweep = _sweep;
167  }
168 
169  float center;
170  float sweep;
171 
172  };
173 
175 
176  public:
177 
182 
186 
187  private:
188 
191 
194 
197 
198  public:
199 
202 
205  virtual void addToConnector( DtOsgSceneConnector* connector );
206 
209  virtual bool removeFromConnector( DtOsgSceneConnector* connector );
210 
214  virtual bool realize(const DtModelDefinition& definition );
215 
218  virtual void setVisible( bool isVisible ) {}
219 
221 
224 
230  virtual void setRelativePosition( double x, double y, double z );
231 
237  virtual void setOrientation( double yaw, double pitch, double roll );
238 
244  virtual void setDimensions( double x, double y, double z );
245 
252  virtual void setColor( float r, float g, float b, float a );
253 
262  virtual void setInsideColor( float r, float g, float b, float a );
263 
270  virtual void setOutsideColor( float r, float g, float b, float a );
271 
276  virtual void setAzimuthRange( float azimuthCenter, float azimuthSweep );
277 
282  virtual void setElevationRange( float elevationCenter, float elevationSweep );
283 
288  virtual void setMaxAngleSegment( float angleSegmentMax );
289 
294  virtual void setShowLines( bool showLines );
295 
300  virtual void setLinesHaveAlpha( bool lineAlpha );
301 
303  virtual void setIsPickable(bool);
304 
306 
312  virtual void updateGeometry();
313 
314  protected:
315 
318 
323  virtual void updateGeometryColors();
324 
328  virtual void updateGeometryWireframeState();
329 
334  virtual void updateGeometryTransforms();
335 
337 
340 
346  double angularDistance( double from, double to );
347 
349 
350  protected:
351 
354 
357 
360 
363 
366 
369 
371 
373  osg::Vec3d myRelativePosition;
374 
377 
379  osg::Vec3d myDimensions;
380 
383 
386 
388  osg::Vec4 myInsideColor;
389 
391  osg::Vec4 myOutsideColor;
392 
395 
398 
401 
404 
405  };
406 
408 
409  template <>
410  inline const char* modelInstanceClassName<DtAttachableEllipsoidArcModelInstance>(void) { return "DtAttachableEllipsoidArcModelInstance"; }
411 
412  template <>
413  inline const char* modelInstanceObjectClass<DtAttachableEllipsoidArcModelInstance>(void) { return "DtOsgEllipsoidArcModel"; }
414 }
osg::ref_ptr< osg::Geode > myFrontGeode
The front facing geometry geode.
Definition: DtAttachableEllipsoidArcModelInstance.h:365
osg::ref_ptr< osg::Group > myWireNode
The wireframe node for the geometry.
Definition: DtAttachableEllipsoidArcModelInstance.h:359
Caches the cartesian version of spherical vertices and their normals into the specified arrays...
Definition: DtAttachableEllipsoidArcModelInstance.h:72
virtual void setVisible(bool isVisible)
no-op
Definition: DtAttachableEllipsoidArcModelInstance.h:218
osg::Vec3Array * myVertices
The osg vertex array to update.
Definition: DtAttachableEllipsoidArcModelInstance.h:99
float myAngleSegmentMax
The max angle used to sample the emitter volume (in degrees)
Definition: DtAttachableEllipsoidArcModelInstance.h:400
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Structure to hold triangles in spherical coordinates while building the geometry. ...
Definition: DtAttachableEllipsoidArcModelInstance.h:132
EllipsoidArcRange(float _center, float _sweep)
Setter CTOR.
Definition: DtAttachableEllipsoidArcModelInstance.h:157
Definition: DtTemplatedModelInstanceCreator.h:32
float center
Definition: DtAttachableEllipsoidArcModelInstance.h:169
osg::ref_ptr< osg::MatrixTransform > myTransform
The offset and scale transform.
Definition: DtAttachableEllipsoidArcModelInstance.h:353
osg::Vec4 myInsideColor
Color at the center of the sphere.
Definition: DtAttachableEllipsoidArcModelInstance.h:388
bool myLineAlphaFlag
Whether the outline lines have alpha or not.
Definition: DtAttachableEllipsoidArcModelInstance.h:397
SphericalVertex bottomRight
Definition: DtAttachableEllipsoidArcModelInstance.h:126
SphericalVertex v2
Definition: DtAttachableEllipsoidArcModelInstance.h:142
SphericalVertex topLeft
Definition: DtAttachableEllipsoidArcModelInstance.h:123
osg::Vec3Array * myNormals
The osg normal array to update.
Definition: DtAttachableEllipsoidArcModelInstance.h:102
double myRadius
The vertex&#39;s representative radius.
Definition: DtAttachableEllipsoidArcModelInstance.h:66
osg::Vec3d myDimensions
Axis dimensions.
Definition: DtAttachableEllipsoidArcModelInstance.h:379
Simple struct for storing an arc range (center/sweep)
Definition: DtAttachableEllipsoidArcModelInstance.h:148
A model definition Interaction any number of named parameters, and also can be used to store cached d...
Definition: DtModelDefinition.h:42
EllipsoidArcRange myElevationRange
Elevation range (center/sweep)
Definition: DtAttachableEllipsoidArcModelInstance.h:385
Contains makVrv::DtOsgModelInstance class.
DtOsgSceneConnector is used by models to create an OSG position/orientation transform so that it can ...
Definition: DtOsgSceneConnector.h:77
double myAzimuth
The vertex&#39;s representative azimuth.
Definition: DtAttachableEllipsoidArcModelInstance.h:63
osg::Quat myRelativeOrientation
Relative orientation.
Definition: DtAttachableEllipsoidArcModelInstance.h:376
SphericalVertex v1
Definition: DtAttachableEllipsoidArcModelInstance.h:141
bool myShowLines
Whether or not to display the emitter volume outline lines.
Definition: DtAttachableEllipsoidArcModelInstance.h:394
SphericalVertex bottomLeft
Definition: DtAttachableEllipsoidArcModelInstance.h:125
The base class for simple OSG based model instances. This call can&#39;t be instantiated itself...
Definition: DtOsgModelInstance.h:77
Structure to hold a quad in spherical coordinates during geometry construction.
Definition: DtAttachableEllipsoidArcModelInstance.h:111
void set(float _center, float _sweep)
Sets the center and sweep on this range.
Definition: DtAttachableEllipsoidArcModelInstance.h:163
std::map< SphericalVertex, int > SphericalToIndexMap
Map type for mapping SphericalVertex&#39;s to their indices.
Definition: DtAttachableEllipsoidArcModelInstance.h:93
DtTemplatedModelInstanceCreator< DtAttachableEllipsoidArcModelInstance > DtAttachableEllipsoidArcModelInstanceCreator
Definition: DtAttachableEllipsoidArcModelInstance.h:407
Contains the DtTemplatedModelInstanceCreator class declaration.
double myInclination
The vertex&#39;s representative inclination.
Definition: DtAttachableEllipsoidArcModelInstance.h:60
osg::Vec4 myOutsideColor
Color on the external points of the sphere.
Definition: DtAttachableEllipsoidArcModelInstance.h:391
float sweep
Definition: DtAttachableEllipsoidArcModelInstance.h:170
EllipsoidArcRange()
Default CTOR.
Definition: DtAttachableEllipsoidArcModelInstance.h:151
Model instance to draw a EllipsoidArc.
Definition: DtAttachableEllipsoidArcModelInstance.h:24
EllipsoidArcRange myAzimuthRange
Azimuth range (center/sweep)
Definition: DtAttachableEllipsoidArcModelInstance.h:382
osg::ref_ptr< osg::Group > myBlendNode
The blending node for the geometry.
Definition: DtAttachableEllipsoidArcModelInstance.h:356
int myCenterVertexIndex
Definition: DtAttachableEllipsoidArcModelInstance.h:370
int myNextIndex
The index of the next inserted vertex.
Definition: DtAttachableEllipsoidArcModelInstance.h:105
osg::ref_ptr< osg::Geometry > myGeometry
The model instance&#39;s geometry.
Definition: DtAttachableEllipsoidArcModelInstance.h:362
bool myFlashing
Like HTML blink.
Definition: DtAttachableEllipsoidArcModelInstance.h:403
SphericalVertex topRight
Definition: DtAttachableEllipsoidArcModelInstance.h:124
Structure to hold a vertex in spherical coordinates during geometry construction. ...
Definition: DtAttachableEllipsoidArcModelInstance.h:33
osg::ref_ptr< osg::Geode > myBackGeode
The back facing geometry geode.
Definition: DtAttachableEllipsoidArcModelInstance.h:368
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
const char * modelInstanceClassName< DtAttachableEllipsoidArcModelInstance >(void)
Definition: DtAttachableEllipsoidArcModelInstance.h:410
SphericalToIndexMap mySphericalToIndexMap
Stores the indices of the vertices in the vertex array.
Definition: DtAttachableEllipsoidArcModelInstance.h:96
osg::Vec3d myRelativePosition
Relative position offset.
Definition: DtAttachableEllipsoidArcModelInstance.h:373
const char * modelInstanceObjectClass< DtAttachableEllipsoidArcModelInstance >(void)
Definition: DtAttachableEllipsoidArcModelInstance.h:413
SphericalVertex v3
Definition: DtAttachableEllipsoidArcModelInstance.h:143

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)