VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtAttachableEllipsoidArcModelInstance.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2012 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
15 
16 #include <osg/MatrixTransform>
17 #include <osg/Geometry>
18 
19 namespace makVrv
20 {
21 
25  {
26  public:
27 
30 
35 
39 
42  virtual void addToConnector( DtOsgSceneConnector* connector );
43 
46  virtual bool removeFromConnector( DtOsgSceneConnector* connector );
47 
50  virtual bool realize( DtModelDefinition& definition );
51 
54  virtual void setVisible( bool isVisible ) {}
55 
57 
60 
66  virtual void setRelativePosition( double x, double y, double z );
67 
73  virtual void setOrientation( double yaw, double pitch, double roll );
74 
80  virtual void setDimensions( double x, double y, double z );
81 
88  virtual void setColor( float r, float g, float b, float a );
89 
98  virtual void setInsideColor( float r, float g, float b, float a );
99 
106  virtual void setOutsideColor( float r, float g, float b, float a );
107 
112  virtual void setAzimuthRange( float azimuthCenter, float azimuthSweep );
113 
118  virtual void setElevationRange( float elevationCenter, float elevationSweep );
119 
124  virtual void setMaxAngleSegment( float angleSegmentMax );
125 
130  virtual void setShowLines( bool showLines );
131 
136  virtual void setLinesHaveAlpha( bool lineAlpha );
137 
145  virtual void setLockUpdates( bool lock );
146 
148 
149  protected:
150 
153 
159  virtual void updateGeometry();
160 
166  virtual void updateGeometryColors();
167 
171  virtual void updateGeometryWireframeState();
172 
177  virtual void updateGeometryTransforms();
178 
180 
181  protected:
182 
185 
189 
195  SphericalVertex( double _inclination, double _azimuth, double _radius );
196 
200  SphericalVertex( const osg::Vec3& cartesian );
201 
207  bool operator < ( const SphericalVertex& rhs ) const;
208 
212  osg::Vec3 toCartesian() const;
213 
216 
218  double myAzimuth;
219 
221  double myRadius;
222 
223  };
224 
227  struct VertexCache
228  {
229 
236  VertexCache( osg::Vec3Array* vertices, osg::Vec3Array* normals );
237 
245  int getIndex( const SphericalVertex& vertex );
246 
248  typedef std::map<SphericalVertex, int> SphericalToIndexMap;
249 
252 
254  osg::Vec3Array* myVertices;
255 
257  osg::Vec3Array* myNormals;
258 
261 
262  };
263 
267  {
268 
275  SphericalQuad( SphericalVertex _topLeft, SphericalVertex _topRight,
276  SphericalVertex _bottomLeft, SphericalVertex _bottomRight );
277 
282 
283  };
284 
287  struct Triangle {
288 
295 
299 
300  };
301 
307  double angularDistance( double from, double to );
308 
311 
314  : center(0)
315  , sweep(0)
316  {}
317 
319  EllipsoidArcRange( float _center, float _sweep )
320  {
321  set( _center, _sweep );
322  }
323 
325  inline void set( float _center, float _sweep )
326  {
327  center = _center;
328  sweep = _sweep;
329  }
330 
331  float center;
332  float sweep;
333 
334  };
335 
337 
338  protected:
339 
341  osg::ref_ptr<osg::MatrixTransform> myTransform;
342 
344  osg::ref_ptr<osg::Group> myBlendNode;
345 
347  osg::ref_ptr<osg::Group> myWireNode;
348 
350  osg::ref_ptr<osg::Geometry> myGeometry;
351 
353  osg::ref_ptr<osg::Geode> myFrontGeode;
354 
356  osg::ref_ptr<osg::Geode> myBackGeode;
357 
359 
362 
365 
368 
370  osg::Vec3d myRelativePosition;
371 
374 
376  osg::Vec3d myDimensions;
377 
380 
383 
385  osg::Vec4 myInsideColor;
386 
388  osg::Vec4 myOutsideColor;
389 
392 
395 
398 
401 
402  };
403 
404 
408  {
409  public:
410 
414 
418  static void registerCreator( DtDe& de );
419 
423  virtual DtModelInstance* create( DtDe& de );
424 
425  protected:
426 
430 
431  };
432 
433 }

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)