VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 <osgText/Font>
29 
30 #include <vrvOsg/DtOsgRenderer.h>
33 
34 #include <string>
35 #include <vector>
36 #include <math.h>
37 
38 #include <boost/scoped_ptr.hpp>
39 
40 namespace makVrf
41 {
47  {
48  public:
49  struct BufferInfo
50  {
51  BufferInfo(long name, DtString tag);
52 
54  long name;
58  bool drawing;
59  };
60 
61  class Buffer;
62 
63  typedef std::vector<BufferInfo> BufferVector;
64  typedef std::map<long,Buffer> BufferMap;
65  typedef std::map<std::string, bool> TagSet;
66 
72  DtKynapseLinesModel(makVrv::DtDe& de, makVrv::DtUniqueID id, double distanceThreshold = 500000);
73 
75  virtual ~DtKynapseLinesModel();
76 
81  virtual void init(std::string& str, bool useLocalCoord = false);
82 
85  virtual void update();
86 
89  virtual void updateAll();
90 
92  virtual BufferVector bufferNames();
93 
95  virtual void drawBufferWithName(std::string tag, bool draw);
96 
98  virtual void transformToLocal(DtVector&);
99 
101  virtual osg::Group* parentNode();
102 
104  virtual double distanceThresholdSquared();
105 
108 
115  {
116  public:
121  DtRegionalGeodeInfo(osg::Group* parent, const DtVector& location);
122 
125  DtVector transformVec(const DtVector& inputVec);
126 
128  virtual void addLine(
129  const DtVector& localStart,
130  const DtVector& localEnd,
132  unsigned width);
133 
135  virtual void addSphere(
136  const DtVector& center,
137  double radius,
138  const DtDebugDrawerGeometryMemoryColor& color);
139 
140  virtual void addTriangle(
141  const DtVector& p1, const DtVector& p2, const DtVector& p3,
142  const DtDebugDrawerGeometryMemoryColor& color);
143 
144  virtual void addText(
145  const DtVector& location,
146  const DtString& text,
148  unsigned size,
149  bool absolute);
150 
152  osg::Vec3d position();
153 
154  private:
155  osg::ref_ptr<osg::PositionAttitudeTransform> myTransform;
157  osg::ref_ptr<osg::Geode> myGeode;
159  osg::ref_ptr<osg::Vec3dArray> myPoints;
161  osg::ref_ptr<osg::Vec4dArray> myColors;
163  osg::ref_ptr<osg::Vec3dArray> myNormals;
164 
167  {
168  typedef std::map<unsigned, LineGeometry> Map;
169  typedef Map::value_type Entry;
170 
171  void init(
172  unsigned width,
173  osg::ref_ptr<osg::Vec3dArray> points,
174  osg::ref_ptr<osg::Vec4dArray> colors);
175 
176  osg::ref_ptr<osg::Geometry> myGeometry;
177  osg::ref_ptr<osg::DrawElementsUInt> myPrimitive;
178  };
179 
181 
183  osg::ref_ptr<osg::Geometry> myTriangleGeometry;
184  osg::ref_ptr<osg::DrawElementsUInt> myTrianglePrimitive;
185 
186  osg::ref_ptr<osgText::Font> myFont;
187  osg::ref_ptr<osg::Geode> myTextGeode;
188  osg::ref_ptr<osg::Geode> myAbsoluteTextGeode;
189 
190  osg::ref_ptr<osg::Geode> mySphereGeode;
191  };
192 
195  class Buffer
196  {
197  public:
199  Buffer();
200 
202  ~Buffer();
203 
208  void update(DtKynapseLinesModel& model);
209 
210  void markForDelete() { myMarkedForDelete = true; }
211  bool isMarkedForDelete() { return myMarkedForDelete; }
212 
213  private:
214  typedef std::list<DtRegionalGeodeInfo> RegionalInfoList;
215 
218  DtRegionalGeodeInfo findOrCreateRegionalNode(
219  osg::Group* parent,
220  const DtVector& location,
221  double distanceSq);
222 
223  osg::ref_ptr<osg::Group> myGroup;
224  unsigned long myLastFrameNumber;
228  };
229 
230  protected:
232  osg::ref_ptr<osg::Group> myGroupNode;
235  boost::scoped_ptr<DtDebugDrawerSharedMemoryManager> sharedMemory;
239  };
240 }
241 

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)