VR-Forces 4.3.1 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 #include <boost/signals.hpp>
17 #include <vector>
18 #include <list>
19 
20 namespace makVrv
21 {
22  class DtDe;
23  class DtModel;
24  class DtQuat;
25  class DtSceneObjectUpdater;
26 
41  {
42 
43  public:
44 
46  {
48  DtTaitBryan orientation;
49  };
50 
51  typedef std::vector<ObjectTransform> TransformList;
52 
53  // A record which stores a model and it's visibility.
54  struct ModelRecord
55  {
58  };
59 
60  // Utility functor object for using std::find_if with the ModelList.
62  {
63  FindModelFunctor(DtModel* aKey = 0) : myKey(aKey) {}
64  FindModelFunctor(const FindModelFunctor& fm) : myKey(fm.myKey) {}
65 
66  bool operator() (const DtSceneObject::ModelRecord& rec) const
67  {
68  return myKey == rec.model;
69  }
70 
72  };
73 
74  typedef std::vector<ModelRecord> ModelList;
75 
76  enum ModelSet
77  {
78  ModelSet_Unspecified = -1,
79  ModelSet_3D = 0,
80  ModelSet_3DColorized = 1,
81  ModelSet_2DIcons = 5
82  };
83 
85  DtSceneObject( DtDe& de, DtUniqueID id );
86 
88  virtual ~DtSceneObject();
89 
92  void addModel(DtModel* model, int visualizerType );
93 
95  void removeModel(DtModel* model );
96 
98  void removeModels();
99 
102  void setPosition( int vtx, const DtVector& position );
103 
105  void addPosition( int vtx, const DtVector& position );
106 
108  void getPosition( int vtx, DtVector& position ) const;
109 
113  void setOffset( const DtVector& offset );
114 
116  void getOffset( DtVector& offset ) const;
117 
119  void setOrientation( int vtx, const DtTaitBryan& orientation );
120 
122  // topographic coordinate system (x north, y east, z down)
123  void setTopographicOrientation( int vtx,
124  const DtTaitBryan& topoOrientation );
125 
127  void getOrientation( int vtx, DtTaitBryan& orientation ) const;
128 
130  // topographic coordinate system (x north, y east, z down)
131  void getTopographicOrientation( int vtx, DtTaitBryan& orientation ) const;
132 
134  void getOrientation( int vtx, DtQuat& orientation ) const;
135 
137  void setColor(float r, float g, float b, float a);
138 
141  void setModelSet( int modelSet );
142 
144  int modelSet() const;
145 
148  void setIsProp( bool isProp );
149 
151  bool isProp() const;
152 
154  void setIsSupportObject( bool b );
155 
157  bool isSupportObject();
158 
160  void setSolid( bool b );
161 
163  bool isSolid() const;
164 
166  DtElementID elementID() const;
167 
169  void setElementID( DtElementID elementID );
170 
172  DtUniqueID uniqueId() const;
173 
175  const ModelList& models() const;
176 
178  ModelList& models();
179 
181  const TransformList& transforms() const;
182 
184  virtual void removePosition(int);
185 
188  void setBoundingBoxSize(double minX, double maxX,
189  double minY, double maxY, double minZ, double maxZ);
190 
192  const DtVector& boundingBoxExtents() const;
193 
195  void getBoundingBoxExtents(double& x, double& y, double& z) const;
196 
198  const DtVector& boundingBoxCenter() const;
199 
201  void getBoundingBoxCenter(double& x, double& y, double& z) const;
202 
204  double boundingRadius() const;
205 
209  void setVisible( bool visible );
210 
215  bool isVisible() const;
216 
218  void setUpdater(DtSceneObjectUpdater* updater);
219 
221  DtSceneObjectUpdater* findUpdater();
222  const DtSceneObjectUpdater* findUpdater() const;
223 
226 
228  boost::signal<void (DtModel*)> signal_modelAdded;
229 
231  boost::signal<void (DtModel*)> signal_modelRemoved;
232 
234  boost::signal< void (const DtUniqueID&) > signal_sceneObjectToBeDeleted;
235 
237  boost::signal<void (DtSceneObject*)> signal_boundingVolumeChanged;
238 
240 
241  protected:
242 
244  void initializeModel( DtModel* modelInstanceOwner );
245 
247  void modelChanged( DtModel* model );
248 
251  // are not. I highly doubt that this works at all, so please ignore.
252  bool modelVisibilityRequested( DtModel* model, bool visible);
253 
255  void resetModelTransforms();
256 
259  void updateBoundingBoxViaContents();
260 
262  void calculateBoundingRadius();
263 
264  protected:
265 
271 
273  bool myIsProp;
283  };
284 }

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)