VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtSceneObject.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
13 #include <vrvCore/DtUniqueID.h>
14 #include <matrix/vlVector.h>
15 #include <matrix/vlTaitBryan.h>
16 
17 #include <boost/signals.hpp>
18 
19 namespace makVrv
20 {
21  class DtDe;
22  class DtModel;
23  class DtQuat;
24  class DtSceneObjectUpdater;
25 
40  {
41 
42  public:
43 
45  {
47  DtTaitBryan orientation;
48  };
49 
50  typedef std::vector<ObjectTransform> TransformList;
51 
52  // A record which stores a model and it's visibility.
53  struct ModelRecord
54  {
57  };
58 
59  // Utility functor object for using std::find_if with the ModelList.
61  {
62  FindModelFunctor(DtModel* aKey = 0) : myKey(aKey) {}
63  FindModelFunctor(const FindModelFunctor& fm) : myKey(fm.myKey) {}
64 
65  bool operator() (const DtSceneObject::ModelRecord& rec) const
66  {
67  return myKey == rec.model;
68  }
69 
71  };
72 
73  typedef std::vector<ModelRecord> ModelList;
74 
75  enum ModelSet
76  {
77  ModelSet_Unspecified = -1,
78  ModelSet_3D = 0,
79  ModelSet_3DColorized = 1,
80  ModelSet_2DIcons = 5
81  };
82 
84  DtSceneObject( DtDe& de, DtUniqueID id );
85 
87  virtual ~DtSceneObject();
88 
91  void addModel(DtModel* model, int visualizerType );
92 
94  void removeModel(DtModel* model );
95 
97  void removeModels();
98 
101  void setPosition( int vtx, const DtVector& position );
102 
104  void addPosition( int vtx, const DtVector& position );
105 
107  void getPosition( int vtx, DtVector& position ) const;
108 
112  void setOffset( const DtVector& offset );
113 
115  void getOffset( DtVector& offset ) const;
116 
118  void setOrientation( int vtx, const DtTaitBryan& orientation );
119 
121  // topographic coordinate system (x north, y east, z down)
122  void setTopographicOrientation( int vtx,
123  const DtTaitBryan& topoOrientation );
124 
126  void getOrientation( int vtx, DtTaitBryan& orientation ) const;
127 
129  // topographic coordinate system (x north, y east, z down)
130  void getTopographicOrientation( int vtx, DtTaitBryan& orientation ) const;
131 
133  void getOrientation( int vtx, DtQuat& orientation ) const;
134 
136  void setColor(float r, float g, float b, float a);
137 
140  void setModelSet( int modelSet );
141 
143  int modelSet() const;
144 
147  void setIsProp( bool isProp );
148 
150  bool isProp() const;
151 
153  void setIsSupportObject( bool b );
154 
156  bool isSupportObject();
157 
159  void setSolid( bool b );
160 
162  bool isSolid() const;
163 
165  DtElementID elementID() const;
166 
168  void setElementID( DtElementID elementID );
169 
171  DtUniqueID uniqueId() const;
172 
174  const ModelList& models() const;
175 
177  ModelList& models();
178 
180  const TransformList& transforms() const;
181 
183  virtual void removePosition(int);
184 
187  void setBoundingBoxSize(double minX, double maxX,
188  double minY, double maxY, double minZ, double maxZ);
189 
191  const DtVector& boundingBoxExtents() const;
192 
194  void getBoundingBoxExtents(double& x, double& y, double& z) const;
195 
197  const DtVector& boundingBoxCenter() const;
198 
200  void getBoundingBoxCenter(double& x, double& y, double& z) const;
201 
203  double boundingRadius() const;
204 
208  void setVisible( bool visible );
209 
214  bool isVisible() const;
215 
217  void setUpdater(DtSceneObjectUpdater* updater);
218 
220  DtSceneObjectUpdater* findUpdater();
221  const DtSceneObjectUpdater* findUpdater() const;
222 
225 
227  boost::signal<void (DtModel*)> signal_modelAdded;
228 
230  boost::signal<void (DtModel*)> signal_modelRemoved;
231 
233  boost::signal< void (const DtUniqueID&) > signal_sceneObjectToBeDeleted;
234 
236  boost::signal<void (DtSceneObject*)> signal_boundingVolumeChanged;
237 
239 
240  protected:
241 
243  void initializeModel( DtModel* modelInstanceOwner );
244 
246  void modelChanged( DtModel* model );
247 
250  // are not. I highly doubt that this works at all, so please ignore.
251  bool modelVisibilityRequested( DtModel* model, bool visible);
252 
254  void resetModelTransforms();
255 
258  void updateBoundingBoxViaContents();
259 
261  void calculateBoundingRadius();
262 
263  protected:
264 
270 
272  bool myIsProp;
282  };
283 }

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)