AGX Dynamics  2.35.0.1
HeightFieldDeformer.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXMODEL_HEIGHT_FIELD_DEFORMER_H
18 #define AGXMODEL_HEIGHT_FIELD_DEFORMER_H
19 
20 #include <agxModel/export.h>
21 
23 #include <agxSDK/Simulation.h>
24 #include <agxCollide/HeightField.h>
25 #include <agx/Journal.h>
26 
27 namespace agxModel
28 {
29  class HeightFieldDeformer;
30 
37  {
39  public:
40 
45 
49  agxCollide::HeightField* getHeightField() const;
50 
52  bool isValid() const;
53 
57  const agx::Vec2iVector& getModifiedIndices() const;
58 
63  const agx::RealVector& getHeightDifferences() const;
64 
72 
74 
75  protected:
76  virtual ~HeightFieldDeformer();
78 
79  protected:
81  bool m_valid;
84 
85 
86  };
87 
89 
90  // Implementations
91 
93  {
94  return m_heightField;
95  }
96 
97 
99  {
100  return m_valid;
101  }
102 
103 
105  {
106  return m_modifiedIndices;
107  }
108 
109 
111  {
112  return m_heightDifferences;
113  }
114 
115 
117  {
118  }
119 
124  {
125  public:
131 
136  virtual void preCollide(const agx::TimeStamp& time) override;
137 
142  virtual void pre(const agx::TimeStamp& time) override;
143 
148  virtual void post(const agx::TimeStamp& time) override;
149 
151  virtual void addNotification() override;
152 
154 
155  protected:
156 
158 
159  void storeHeights();
160 
162 
164 
166 
168 
170 
172 
174 
175  private:
177 
179  // Variables
181  protected:
189  };
190 }
191 
192 #endif
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXMODEL_EXPORT
A HeightField is a collision shape that can be created from a grid structure, like an image.
Abstract representation of a data buffer.
Definition: Buffer.h:56
Utility class used to record HeightFieldDeformer in an agx::Journal.
virtual void addNotification() override
Called when this object is added to a simulation.
agxSDK::Simulation::JournalAttachEvent::CallbackType m_journalAttachedCallback
virtual void pre(const agx::TimeStamp &time) override
Called before a step is taken in the simulation.
void journalAttachedCallback(agxSDK::Simulation *simulation, agx::Journal *journal)
void createJournalBindings(agx::Journal *journal)
virtual void post(const agx::TimeStamp &time) override
Called after a step is taken in the simulation.
HeightFieldDeformerJournalRecorder(HeightFieldDeformer *deformableHeightField)
Constructor for the HeightFieldDeformerJournalRecorder.
virtual void preCollide(const agx::TimeStamp &time) override
Called before the collision detection step is taken in the simulation.
HeightFieldDeformer contains a agxCollide::HeightField.
static bool extractHeightFieldDeformers(agxModel::HeightFieldDeformerPtrVector &deformers, agxSDK::Simulation *simulation)
Utility function to extract all HeightFieldDeformers from an simulation (and its sub-simulation).
agxCollide::HeightFieldRef m_heightField
agxCollide::HeightField * getHeightField() const
Return the HeightFieldDeformer geometry (which is created in HeightFieldDeformer constructor)
const agx::RealVector & getHeightDifferences() const
HeightFieldDeformer(agxCollide::HeightField *heightField, agxSDK::StepEventListener::ActivationMask mask)
Constructor.
bool isValid() const
Is the deformer valid? If not, no actions will be taken.
const agx::Vec2iVector & getModifiedIndices() const
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
Derive from this class to implement a listener for simulation step events.
ActivationMask
Defines the event states for which a listener will be activated, a mask can be bitwise OR:ed from the...
T CallbackType
Definition: Event.h:37
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Definition: Uuid.h:42
Vector containing 'raw' data.
Definition: agx/Vector.h:246
#define AGX_FORCE_INLINE
Definition: macros.h:58
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:37
agx::VectorPOD< HeightFieldDeformer * > HeightFieldDeformerPtrVector
agx::ref_ptr< HeightFieldDeformer > HeightFieldDeformerRef
agx::Real TimeStamp
Definition: TimeStamp.h:26