VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
entityTerrainGeometryHandle.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
17 
20 
21 #include <vector>
22 #include <boost/unordered_map.hpp>
23 #include <tbb/spin_mutex.h>
24 
25 class DtPoint;
26 class DtTaitBryan;
27 
31 {
32 public:
36  {
37  public:
38  typedef boost::shared_ptr<CollisionObject> Ptr;
39 
41 
42  bool enabled() const;
43 
44  void incrementEnableCount();
45  void decrementEnableCount();
46 
47  protected:
48  tbb::atomic<unsigned> myEnableCount;
49  };
50 
52  {
53  public:
54  explicit DynamicFeature(const DtPoint& location, double radius);
55 
56  ~DynamicFeature();
57 
58  DtString description() const;
59 
60  bool matches(const makVrv::DtDynamicTerrainChange&, bool useOriginalGeometry = false) const;
61  bool matches(const makVrv::DtDynamicTerrainGeometry&, bool useOriginalGeometry = false) const;
62 
63  const makVrv::DtDynamicTerrainGeometry* geometry() const;
64  const makVrv::DtDynamicTerrainGeometry* originalGeometry() const;
65 
66  bool isInDefaultState() const;
67  bool lastStateWasDefaultState() const;
68  void changeState(const makVrv::DtDynamicTerrainChanges& history);
69  void iterateCommands(const boost::function<void(const makVrv::DtDynamicTerrainChange&)>&) const;
70 
71  void setToDefaultState();
72 
73  makVrv::DtDynamicTerrainChange* createChange() const;
74 
75  protected:
78 
79  tbb::atomic<bool> myDefaultStateFlag;
80  };
81 
82  typedef std::vector<CollisionObject::Ptr> CollisionObjectVector;
83  typedef boost::unordered_map<DtAppearance, CollisionObjectVector> AppearanceMap;
84 
86  explicit DtEntityTerrainGeometryHandle(DtVantageTerrainEngine& engine, const DtFilename& model);
87 
90 
92  bool isValid() const;
93 
95 
96  bool isDisabled() const;
97  void disable();
98  void setAppearance(DtAppearance app);
99  void setPosition(const DtPoint& location, const DtDcm& orientation);
101 
102 protected:
104  virtual CollisionObjectVector& loadAppearance(DtAppearance flags);
105 
106  virtual void setupDynamicFeature(const DtPoint& location, double radius);
107  void destroyDynamicFeature();
108 
109  mutable tbb::spin_mutex myMutex;
110 
112  const DtFilename myFile;
113 
114  boost::optional<DtAppearance> myCurrentAppearance;
115  boost::optional<DtPoint> myCurrentLocation;
116  boost::optional<DtDcm> myCurrentOrientation;
117 
118  boost::shared_ptr<DynamicFeature> myFeature;
121 
123 };

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)