VR-Forces 5.0.2 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) 2020 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
13 
14 #include <osg/MatrixTransform>
15 #include <osg/Geometry>
16 
17 namespace makVrv
18 {
19 
23  {
24  public:
25 
28 
31  struct SphericalVertex {
32 
38  SphericalVertex(double _inclination, double _azimuth, double _radius);
39 
43  SphericalVertex(const osg::Vec3& cartesian);
44 
50  bool operator < (const SphericalVertex& rhs) const;
51 
55  osg::Vec3 toCartesian() const;
56 
58  double myInclination;
59 
61  double myAzimuth;
62 
64  double myRadius;
65 
66  };
67 
70  struct VertexCache
71  {
72 
79  VertexCache(osg::Vec3Array* vertices, osg::Vec3Array* normals);
80 
88  int getIndex(const SphericalVertex& vertex);
89 
91  typedef std::map<SphericalVertex, int> SphericalToIndexMap;
92 
95 
97  osg::Vec3Array* myVertices;
98 
100  osg::Vec3Array* myNormals;
101 
104 
105  };
106 
110  {
111 
118  SphericalQuad(const SphericalVertex& _topLeft, const SphericalVertex& _topRight,
119  const SphericalVertex& _bottomLeft, const SphericalVertex& _bottomRight);
120 
125 
126  };
127 
130  struct Triangle {
131 
137  Triangle(const SphericalVertex& _v1, const SphericalVertex& _v2, const SphericalVertex& _v3);
138 
142 
143  };
144 
147 
150  : center(0)
151  , sweep(0)
152  {}
153 
155  EllipsoidArcRange(float _center, float _sweep)
156  {
157  set(_center, _sweep);
158  }
159 
161  inline void set(float _center, float _sweep)
162  {
163  center = _center;
164  sweep = _sweep;
165  }
166 
167  float center;
168  float sweep;
169 
170  };
171 
173 
174  public:
175 
180 
184 
185  private:
186 
189 
192 
195 
196  public:
197 
200 
203  virtual void addToConnector( DtOsgSceneConnector* connector );
204 
207  virtual bool removeFromConnector( DtOsgSceneConnector* connector );
208 
212  virtual bool realize( DtModelDefinition& definition );
213 
216  virtual void setVisible( bool isVisible ) {}
217 
219 
222 
228  virtual void setRelativePosition( double x, double y, double z );
229 
235  virtual void setOrientation( double yaw, double pitch, double roll );
236 
242  virtual void setDimensions( double x, double y, double z );
243 
250  virtual void setColor( float r, float g, float b, float a );
251 
260  virtual void setInsideColor( float r, float g, float b, float a );
261 
268  virtual void setOutsideColor( float r, float g, float b, float a );
269 
274  virtual void setAzimuthRange( float azimuthCenter, float azimuthSweep );
275 
280  virtual void setElevationRange( float elevationCenter, float elevationSweep );
281 
286  virtual void setMaxAngleSegment( float angleSegmentMax );
287 
292  virtual void setShowLines( bool showLines );
293 
298  virtual void setLinesHaveAlpha( bool lineAlpha );
299 
301 
307  virtual void updateGeometry();
308 
309  protected:
310 
313 
318  virtual void updateGeometryColors();
319 
323  virtual void updateGeometryWireframeState();
324 
329  virtual void updateGeometryTransforms();
330 
332 
335 
341  double angularDistance( double from, double to );
342 
344 
345  protected:
346 
349 
352 
355 
358 
361 
364 
366 
368  osg::Vec3d myRelativePosition;
369 
372 
374  osg::Vec3d myDimensions;
375 
378 
381 
383  osg::Vec4 myInsideColor;
384 
386  osg::Vec4 myOutsideColor;
387 
390 
393 
396 
399 
400  };
401 
402 
406  {
407  public:
408 
412 
416  static void registerCreator( DtDe& de );
417 
421  virtual DtModelInstance* create( DtDe& de );
422 
423  protected:
424 
428 
429  };
430 
431 }
The base class for all model instances.
Definition: DtModelInstance.h:39
osg::ref_ptr< osg::Geode > myFrontGeode
The front facing geometry geode.
Definition: DtAttachableEllipsoidArcModelInstance.h:360
osg::ref_ptr< osg::Group > myWireNode
The wireframe node for the geometry.
Definition: DtAttachableEllipsoidArcModelInstance.h:354
Caches the cartesian version of spherical vertices and their normals into the specified arrays...
Definition: DtAttachableEllipsoidArcModelInstance.h:70
virtual void setVisible(bool isVisible)
no-op
Definition: DtAttachableEllipsoidArcModelInstance.h:216
A Creator for the DtAttachableEllipsoidArcModelInstance class.
Definition: DtAttachableEllipsoidArcModelInstance.h:405
osg::Vec3Array * myVertices
The osg vertex array to update.
Definition: DtAttachableEllipsoidArcModelInstance.h:97
float myAngleSegmentMax
The max angle used to sample the emitter volume (in degrees)
Definition: DtAttachableEllipsoidArcModelInstance.h:395
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Structure to hold triangles in spherical coordinates while building the geometry. ...
Definition: DtAttachableEllipsoidArcModelInstance.h:130
EllipsoidArcRange(float _center, float _sweep)
Setter CTOR.
Definition: DtAttachableEllipsoidArcModelInstance.h:155
float center
Definition: DtAttachableEllipsoidArcModelInstance.h:167
osg::ref_ptr< osg::MatrixTransform > myTransform
The offset and scale transform.
Definition: DtAttachableEllipsoidArcModelInstance.h:348
osg::Vec4 myInsideColor
Color at the center of the sphere.
Definition: DtAttachableEllipsoidArcModelInstance.h:383
bool myLineAlphaFlag
Whether the outline lines have alpha or not.
Definition: DtAttachableEllipsoidArcModelInstance.h:392
SphericalVertex bottomRight
Definition: DtAttachableEllipsoidArcModelInstance.h:124
SphericalVertex v2
Definition: DtAttachableEllipsoidArcModelInstance.h:140
SphericalVertex topLeft
Definition: DtAttachableEllipsoidArcModelInstance.h:121
osg::Vec3Array * myNormals
The osg normal array to update.
Definition: DtAttachableEllipsoidArcModelInstance.h:100
double myRadius
The vertex&#39;s representative radius.
Definition: DtAttachableEllipsoidArcModelInstance.h:64
osg::Vec3d myDimensions
Axis dimensions.
Definition: DtAttachableEllipsoidArcModelInstance.h:374
Simple struct for storing an arc range (center/sweep)
Definition: DtAttachableEllipsoidArcModelInstance.h:146
A model definition Interaction any number of named parameters, and also can be used to store cached d...
Definition: DtModelDefinition.h:38
EllipsoidArcRange myElevationRange
Elevation range (center/sweep)
Definition: DtAttachableEllipsoidArcModelInstance.h:380
Contains makVrv::DtOsgModelInstance class.
DtOsgSceneConnector is used by models to create an OSG position/orientation transform so that it can ...
Definition: DtOsgSceneConnector.h:76
double myAzimuth
The vertex&#39;s representative azimuth.
Definition: DtAttachableEllipsoidArcModelInstance.h:61
osg::Quat myRelativeOrientation
Relative orientation.
Definition: DtAttachableEllipsoidArcModelInstance.h:371
SphericalVertex v1
Definition: DtAttachableEllipsoidArcModelInstance.h:139
bool myShowLines
Whether or not to display the emitter volume outline lines.
Definition: DtAttachableEllipsoidArcModelInstance.h:389
SphericalVertex bottomLeft
Definition: DtAttachableEllipsoidArcModelInstance.h:123
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:109
void set(float _center, float _sweep)
Sets the center and sweep on this range.
Definition: DtAttachableEllipsoidArcModelInstance.h:161
std::map< SphericalVertex, int > SphericalToIndexMap
Map type for mapping SphericalVertex&#39;s to their indices.
Definition: DtAttachableEllipsoidArcModelInstance.h:91
The polymorphic creator for the DtModelInstance.
Definition: DtModelInstance.h:148
double myInclination
The vertex&#39;s representative inclination.
Definition: DtAttachableEllipsoidArcModelInstance.h:58
osg::Vec4 myOutsideColor
Color on the external points of the sphere.
Definition: DtAttachableEllipsoidArcModelInstance.h:386
float sweep
Definition: DtAttachableEllipsoidArcModelInstance.h:168
EllipsoidArcRange()
Default CTOR.
Definition: DtAttachableEllipsoidArcModelInstance.h:149
Model instance to draw a EllipsoidArc.
Definition: DtAttachableEllipsoidArcModelInstance.h:22
EllipsoidArcRange myAzimuthRange
Azimuth range (center/sweep)
Definition: DtAttachableEllipsoidArcModelInstance.h:377
osg::ref_ptr< osg::Group > myBlendNode
The blending node for the geometry.
Definition: DtAttachableEllipsoidArcModelInstance.h:351
int myCenterVertexIndex
Definition: DtAttachableEllipsoidArcModelInstance.h:365
int myNextIndex
The index of the next inserted vertex.
Definition: DtAttachableEllipsoidArcModelInstance.h:103
osg::ref_ptr< osg::Geometry > myGeometry
The model instance&#39;s geometry.
Definition: DtAttachableEllipsoidArcModelInstance.h:357
bool myFlashing
Like HTML blink.
Definition: DtAttachableEllipsoidArcModelInstance.h:398
SphericalVertex topRight
Definition: DtAttachableEllipsoidArcModelInstance.h:122
Structure to hold a vertex in spherical coordinates during geometry construction. ...
Definition: DtAttachableEllipsoidArcModelInstance.h:31
osg::ref_ptr< osg::Geode > myBackGeode
The back facing geometry geode.
Definition: DtAttachableEllipsoidArcModelInstance.h:363
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:70
SphericalToIndexMap mySphericalToIndexMap
Stores the indices of the vertices in the vertex array.
Definition: DtAttachableEllipsoidArcModelInstance.h:94
osg::Vec3d myRelativePosition
Relative position offset.
Definition: DtAttachableEllipsoidArcModelInstance.h:368
SphericalVertex v3
Definition: DtAttachableEllipsoidArcModelInstance.h:141

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)