VR-Forces 4.8 Class Documentation
 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) 2015 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 
33 
37 
40  virtual void addToConnector( DtOsgSceneConnector* connector );
41 
44  virtual bool removeFromConnector( DtOsgSceneConnector* connector );
45 
48  virtual bool realize( DtModelDefinition& definition );
49 
52  virtual void setVisible( bool isVisible ) {}
53 
55 
58 
64  virtual void setRelativePosition( double x, double y, double z );
65 
71  virtual void setOrientation( double yaw, double pitch, double roll );
72 
78  virtual void setDimensions( double x, double y, double z );
79 
86  virtual void setColor( float r, float g, float b, float a );
87 
96  virtual void setInsideColor( float r, float g, float b, float a );
97 
104  virtual void setOutsideColor( float r, float g, float b, float a );
105 
110  virtual void setAzimuthRange( float azimuthCenter, float azimuthSweep );
111 
116  virtual void setElevationRange( float elevationCenter, float elevationSweep );
117 
122  virtual void setMaxAngleSegment( float angleSegmentMax );
123 
128  virtual void setShowLines( bool showLines );
129 
134  virtual void setLinesHaveAlpha( bool lineAlpha );
135 
137 
143  virtual void updateGeometry();
144 
145  protected:
146 
149 
154  virtual void updateGeometryColors();
155 
159  virtual void updateGeometryWireframeState();
160 
165  virtual void updateGeometryTransforms();
166 
168 
169  protected:
170 
173 
177 
183  SphericalVertex( double _inclination, double _azimuth, double _radius );
184 
188  SphericalVertex( const osg::Vec3& cartesian );
189 
195  bool operator < ( const SphericalVertex& rhs ) const;
196 
200  osg::Vec3 toCartesian() const;
201 
204 
206  double myAzimuth;
207 
209  double myRadius;
210 
211  };
212 
215  struct VertexCache
216  {
217 
224  VertexCache( osg::Vec3Array* vertices, osg::Vec3Array* normals );
225 
233  int getIndex( const SphericalVertex& vertex );
234 
236  typedef std::map<SphericalVertex, int> SphericalToIndexMap;
237 
240 
242  osg::Vec3Array* myVertices;
243 
245  osg::Vec3Array* myNormals;
246 
249 
250  };
251 
255  {
256 
263  SphericalQuad( const SphericalVertex& _topLeft, const SphericalVertex& _topRight,
264  const SphericalVertex& _bottomLeft, const SphericalVertex& _bottomRight );
265 
270 
271  };
272 
275  struct Triangle {
276 
282  Triangle( const SphericalVertex& _v1, const SphericalVertex& _v2, const SphericalVertex& _v3 );
283 
287 
288  };
289 
295  double angularDistance( double from, double to );
296 
299 
302  : center(0)
303  , sweep(0)
304  {}
305 
307  EllipsoidArcRange( float _center, float _sweep )
308  {
309  set( _center, _sweep );
310  }
311 
313  inline void set( float _center, float _sweep )
314  {
315  center = _center;
316  sweep = _sweep;
317  }
318 
319  float center;
320  float sweep;
321 
322  };
323 
325 
326  protected:
327 
330 
333 
336 
339 
342 
345 
347 
349  osg::Vec3d myRelativePosition;
350 
353 
355  osg::Vec3d myDimensions;
356 
359 
362 
364  osg::Vec4 myInsideColor;
365 
367  osg::Vec4 myOutsideColor;
368 
371 
374 
377 
380 
381  };
382 
383 
387  {
388  public:
389 
393 
397  static void registerCreator( DtDe& de );
398 
402  virtual DtModelInstance* create( DtDe& de );
403 
404  protected:
405 
409 
410  };
411 
412 }
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:341
osg::ref_ptr< osg::Group > myWireNode
The wireframe node for the geometry.
Definition: DtAttachableEllipsoidArcModelInstance.h:335
Caches the cartesian version of spherical vertices and their normals into the specified arrays...
Definition: DtAttachableEllipsoidArcModelInstance.h:215
virtual void setVisible(bool isVisible)
no-op
Definition: DtAttachableEllipsoidArcModelInstance.h:52
A Creator for the DtAttachableEllipsoidArcModelInstance class.
Definition: DtAttachableEllipsoidArcModelInstance.h:386
osg::Vec3Array * myVertices
The osg vertex array to update.
Definition: DtAttachableEllipsoidArcModelInstance.h:242
float myAngleSegmentMax
The max angle used to sample the emitter volume (in degrees)
Definition: DtAttachableEllipsoidArcModelInstance.h:376
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Structure to hold triangles in spherical coordinates while building the geometry. ...
Definition: DtAttachableEllipsoidArcModelInstance.h:275
EllipsoidArcRange(float _center, float _sweep)
Setter CTOR.
Definition: DtAttachableEllipsoidArcModelInstance.h:307
float center
Definition: DtAttachableEllipsoidArcModelInstance.h:319
osg::ref_ptr< osg::MatrixTransform > myTransform
The offset and scale transform.
Definition: DtAttachableEllipsoidArcModelInstance.h:329
osg::Vec4 myInsideColor
Color at the center of the sphere.
Definition: DtAttachableEllipsoidArcModelInstance.h:364
bool myLineAlphaFlag
Whether the outline lines have alpha or not.
Definition: DtAttachableEllipsoidArcModelInstance.h:373
SphericalVertex bottomRight
Definition: DtAttachableEllipsoidArcModelInstance.h:269
SphericalVertex v2
Definition: DtAttachableEllipsoidArcModelInstance.h:285
SphericalVertex topLeft
Definition: DtAttachableEllipsoidArcModelInstance.h:266
osg::Vec3Array * myNormals
The osg normal array to update.
Definition: DtAttachableEllipsoidArcModelInstance.h:245
double myRadius
The vertex&#39;s representative radius.
Definition: DtAttachableEllipsoidArcModelInstance.h:209
osg::Vec3d myDimensions
Axis dimensions.
Definition: DtAttachableEllipsoidArcModelInstance.h:355
Simple struct for storing an arc range (center/sweep)
Definition: DtAttachableEllipsoidArcModelInstance.h:298
A model definition Interaction any number of named parameters, and also can be used to store cached d...
Definition: DtModelDefinition.h:33
EllipsoidArcRange myElevationRange
Elevation range (center/sweep)
Definition: DtAttachableEllipsoidArcModelInstance.h:361
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:206
osg::Quat myRelativeOrientation
Relative orientation.
Definition: DtAttachableEllipsoidArcModelInstance.h:352
SphericalVertex v1
Definition: DtAttachableEllipsoidArcModelInstance.h:284
bool myShowLines
Whether or not to display the emitter volume outline lines.
Definition: DtAttachableEllipsoidArcModelInstance.h:370
SphericalVertex bottomLeft
Definition: DtAttachableEllipsoidArcModelInstance.h:268
The base class for simple OSG based model instances.
Definition: DtOsgModelInstance.h:72
Structure to hold a quad in spherical coordinates during geometry construction.
Definition: DtAttachableEllipsoidArcModelInstance.h:254
void set(float _center, float _sweep)
Sets the center and sweep on this range.
Definition: DtAttachableEllipsoidArcModelInstance.h:313
std::map< SphericalVertex, int > SphericalToIndexMap
Map type for mapping SphericalVertex&#39;s to their indices.
Definition: DtAttachableEllipsoidArcModelInstance.h:236
The polymorphic creator for the DtModelInstance.
Definition: DtModelInstance.h:148
double myInclination
The vertex&#39;s representative inclination.
Definition: DtAttachableEllipsoidArcModelInstance.h:203
osg::Vec4 myOutsideColor
Color on the external points of the sphere.
Definition: DtAttachableEllipsoidArcModelInstance.h:367
float sweep
Definition: DtAttachableEllipsoidArcModelInstance.h:320
EllipsoidArcRange()
Default CTOR.
Definition: DtAttachableEllipsoidArcModelInstance.h:301
Model instance to draw a EllipsoidArc.
Definition: DtAttachableEllipsoidArcModelInstance.h:22
EllipsoidArcRange myAzimuthRange
Azimuth range (center/sweep)
Definition: DtAttachableEllipsoidArcModelInstance.h:358
osg::ref_ptr< osg::Group > myBlendNode
The blending node for the geometry.
Definition: DtAttachableEllipsoidArcModelInstance.h:332
int myCenterVertexIndex
Definition: DtAttachableEllipsoidArcModelInstance.h:346
int myNextIndex
The index of the next inserted vertex.
Definition: DtAttachableEllipsoidArcModelInstance.h:248
osg::ref_ptr< osg::Geometry > myGeometry
The model instance&#39;s geometry.
Definition: DtAttachableEllipsoidArcModelInstance.h:338
bool myFlashing
Like HTML blink.
Definition: DtAttachableEllipsoidArcModelInstance.h:379
SphericalVertex topRight
Definition: DtAttachableEllipsoidArcModelInstance.h:267
Structure to hold a vertex in spherical coordinates during geometry construction. ...
Definition: DtAttachableEllipsoidArcModelInstance.h:176
osg::ref_ptr< osg::Geode > myBackGeode
The back facing geometry geode.
Definition: DtAttachableEllipsoidArcModelInstance.h:344
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
SphericalToIndexMap mySphericalToIndexMap
Stores the indices of the vertices in the vertex array.
Definition: DtAttachableEllipsoidArcModelInstance.h:239
osg::Vec3d myRelativePosition
Relative position offset.
Definition: DtAttachableEllipsoidArcModelInstance.h:349
SphericalVertex v3
Definition: DtAttachableEllipsoidArcModelInstance.h:286

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)