VR-Forces 4.1.1 Class Documentation
DtSceneObject.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2012 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 
77  DtSceneObject( DtDe& de, DtUniqueID id );
78 
80  ~DtSceneObject();
81 
84  void addModel(DtModel* model, int visualizerType );
85 
87  void removeModel(DtModel* model );
88 
90  void removeModels();
91 
94  void setPosition( int vtx, const DtVector& position );
95 
97  void addPosition( int vtx, const DtVector& position );
98 
100  void getPosition( int vtx, DtVector& position ) const;
101 
105  void setOffset( const DtVector& offset );
106 
108  void getOffset( DtVector& offset ) const;
109 
111  void setOrientation( int vtx, const DtTaitBryan& orientation );
112 
114  void getOrientation( int vtx, DtTaitBryan& orientation ) const;
115 
117  void getOrientation( int vtx, DtQuat& orientation ) const;
118 
120  void setColor(float r, float g, float b, float a);
121 
124  void setModelSet( int modelSet );
125 
127  int modelSet() const;
128 
131  void setIsProp( bool isProp );
132 
134  bool isProp() const;
135 
136  void setSolid( bool b );
137 
139  DtElementID elementID() const;
140 
142  void setElementID( DtElementID elementID );
143 
145  DtUniqueID uniqueId() const;
146 
148  const ModelList& models() const;
149 
151  ModelList& models();
152 
154  const TransformList& transforms() const;
155 
157  virtual void removePosition(int);
158 
161  void setBoundingBoxSize(double minX, double maxX,
162  double minY, double maxY, double minZ, double maxZ);
163 
165  const DtVector& boundingBoxExtents() const;
166 
168  void getBoundingBoxExtents(double& x, double& y, double& z) const;
169 
171  const DtVector& boundingBoxCenter() const;
172 
174  void getBoundingBoxCenter(double& x, double& y, double& z) const;
175 
177  double boundingRadius() const;
178 
182  void setVisible( bool visible );
183 
188  bool isVisible() const;
189 
191  void setUpdater(DtSceneObjectUpdater* updater);
192 
194  DtSceneObjectUpdater* findUpdater();
195  const DtSceneObjectUpdater* findUpdater() const;
196 
199 
201  boost::signal<void (DtModel*)> signal_modelAdded;
202 
204  boost::signal<void (DtModel*)> signal_modelRemoved;
205 
207  boost::signal< void (const DtUniqueID&) > signal_sceneObjectToBeDeleted;
208 
210  boost::signal<void (DtSceneObject*)> signal_boundingVolumeChanged;
211 
213 
214  protected:
215 
217  void initializeModel( DtModel* modelInstanceOwner );
218 
220  void modelChanged( DtModel* model );
221 
224  // are not. I highly doubt that this works at all, so please ignore.
225  bool modelVisibilityRequested( DtModel* model, bool visible);
226 
228  void resetModelTransforms();
229 
232  void updateBoundingBoxViaContents();
233 
235  void calculateBoundingRadius();
236 
237  protected:
238 
244 
246  bool myIsProp;
255  };
256 }

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)