VR-Forces 4.3 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  ~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  void getOrientation( int vtx, DtTaitBryan& orientation ) const;
123 
125  void getOrientation( int vtx, DtQuat& orientation ) const;
126 
128  void setColor(float r, float g, float b, float a);
129 
132  void setModelSet( int modelSet );
133 
135  int modelSet() const;
136 
139  void setIsProp( bool isProp );
140 
142  bool isProp() const;
143 
144  void setSolid( bool b );
145 
147  DtElementID elementID() const;
148 
150  void setElementID( DtElementID elementID );
151 
153  DtUniqueID uniqueId() const;
154 
156  const ModelList& models() const;
157 
159  ModelList& models();
160 
162  const TransformList& transforms() const;
163 
165  virtual void removePosition(int);
166 
169  void setBoundingBoxSize(double minX, double maxX,
170  double minY, double maxY, double minZ, double maxZ);
171 
173  const DtVector& boundingBoxExtents() const;
174 
176  void getBoundingBoxExtents(double& x, double& y, double& z) const;
177 
179  const DtVector& boundingBoxCenter() const;
180 
182  void getBoundingBoxCenter(double& x, double& y, double& z) const;
183 
185  double boundingRadius() const;
186 
190  void setVisible( bool visible );
191 
196  bool isVisible() const;
197 
199  void setUpdater(DtSceneObjectUpdater* updater);
200 
202  DtSceneObjectUpdater* findUpdater();
203  const DtSceneObjectUpdater* findUpdater() const;
204 
207 
209  boost::signal<void (DtModel*)> signal_modelAdded;
210 
212  boost::signal<void (DtModel*)> signal_modelRemoved;
213 
215  boost::signal< void (const DtUniqueID&) > signal_sceneObjectToBeDeleted;
216 
218  boost::signal<void (DtSceneObject*)> signal_boundingVolumeChanged;
219 
221 
222  protected:
223 
225  void initializeModel( DtModel* modelInstanceOwner );
226 
228  void modelChanged( DtModel* model );
229 
232  // are not. I highly doubt that this works at all, so please ignore.
233  bool modelVisibilityRequested( DtModel* model, bool visible);
234 
236  void resetModelTransforms();
237 
240  void updateBoundingBoxViaContents();
241 
243  void calculateBoundingRadius();
244 
245  protected:
246 
252 
254  bool myIsProp;
263  };
264 }

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)