VR-Forces 4.2 Class Documentation
kynapseLinesModel.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
13 #include <vrfGuiCore/vrfGuiCore.h>
14 #include <vrvCore/DtDe.h>
15 #include <vrvCore/DtUniqueID.h>
16 #include <osg/Geode>
18 
19 #include <vrvOsg/DtOsgRenderer.h>
20 
21 #include <osg/Geometry>
22 #include <osg/Geode>
23 #include <osg/LineWidth>
24 #include <osg/PositionAttitudeTransform>
25 #include <osg/ShapeDrawable>
26 #include <osg/Material>
27 #include <vrvOsg/DtOsgNodeTraversalFlags.h>
28 
29 #include <vrvOsg/DtOsgRenderer.h>
30 #include <vrvUtil/DtCoordinateSystem.h>
31 #include <vrvCore/DtDeSharedState.h>
32 
33 #include <string>
34 #include <vector>
35 #include <math.h>
36 
37 #include <boost/scoped_ptr.hpp>
38 
40 
41 namespace makVrf
42 {
48  {
49  public:
50  struct BufferInfo
51  {
52  BufferInfo(long name, DtString tag);
53 
55  long name;
59  bool drawing;
60  };
61 
62  class Buffer;
63 
64  typedef std::vector<BufferInfo> BufferVector;
65  typedef std::map<long,Buffer> BufferMap;
66  typedef std::map<std::string, bool> TagSet;
67 
73  DtKynapseLinesModel(makVrv::DtDe& de, makVrv::DtUniqueID id, double distanceThreshold = 500000);
74 
76  virtual ~DtKynapseLinesModel();
77 
82  virtual void init(std::string& str, bool useLocalCoord = false);
83 
86  virtual void update();
87 
90  virtual void updateAll();
91 
93  virtual BufferVector bufferNames();
94 
96  virtual void drawBufferWithName(std::string tag, bool draw);
97 
99  virtual void transformToLocal(DtVector&);
100 
102  virtual osg::Group* parentNode();
103 
105  virtual double distanceThresholdSquared();
106 
109 
116  {
117  public:
122  DtRegionalGeodeInfo(osg::Group* parent, const DtVector& location);
123 
126  DtVector transformVec(const DtVector& inputVec);
127 
129  virtual void addLine(const DtVector& localStart, const DtVector& localEnd,
130  const DtDebugDrawerGeometryMemoryColor& color);
131 
133  virtual void addSphere(const DtVector& center, double radius,
134  const DtDebugDrawerGeometryMemoryColor& color);
135 
136  virtual void addTriangle(const DtVector& p1, const DtVector& p2, const DtVector& p3,
137  const DtDebugDrawerGeometryMemoryColor& color);
138 
140  osg::Vec3d position();
141 
143  void setLineWidth(bool on, double width=4.0);
144 
145  private:
147  osg::ref_ptr<osg::PositionAttitudeTransform> myTransform;
149  osg::ref_ptr<osg::Geode> myGeode;
151  osg::ref_ptr<osg::Vec3dArray> myPoints;
153  osg::ref_ptr<osg::Vec3dArray> myColors;
155  osg::ref_ptr<osg::Vec3dArray> myNormals;
156 
158  osg::ref_ptr<osg::Geometry> myGeometry;
159  osg::ref_ptr<osg::DrawElementsUInt> myPrimitive;
160 
162  osg::ref_ptr<osg::Geometry> myTriangleGeometry;
163  osg::ref_ptr<osg::DrawElementsUInt> myTrianglePrimitive;
164  };
165 
168  class Buffer
169  {
170  public:
172  Buffer();
173 
175  ~Buffer();
176 
181  void update(DtKynapseLinesModel& model);
182 
183  void markForDelete() { myMarkedForDelete = true; }
184  bool isMarkedForDelete() { return myMarkedForDelete; }
185 
186  private:
187  typedef std::list<DtRegionalGeodeInfo> RegionalInfoList;
188 
191  DtRegionalGeodeInfo findOrCreateRegionalNode(
192  osg::Group* parent,
193  const DtVector& location,
194  double distanceSq);
195 
196  osg::ref_ptr<osg::Group> myGroup;
197  unsigned long myLastFrameNumber;
201  };
202 
203  protected:
204  makVrv::DtDe& myDe;
205  osg::ref_ptr<osg::Group> myGroupNode;
208  boost::scoped_ptr<DtDebugDrawerSharedMemoryManager> sharedMemory;
212  };
213 }
214 

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)