VR-Forces 4.5 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) 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 
329  osg::ref_ptr<osg::MatrixTransform> myTransform;
330 
332  osg::ref_ptr<osg::Group> myBlendNode;
333 
335  osg::ref_ptr<osg::Group> myWireNode;
336 
338  osg::ref_ptr<osg::Geometry> myGeometry;
339 
341  osg::ref_ptr<osg::Geode> myFrontGeode;
342 
344  osg::ref_ptr<osg::Geode> myBackGeode;
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 }

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)