AGXDynamics  2.31.1.0
TerrainMassController.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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 #pragma once
18 
19 #include <agx/config/AGX_USE_AGXTERRAIN.h>
20 #include <agxTerrain/export.h>
21 #include <agx/Referenced.h>
22 #include <agx/Vec3.h>
23 
24 namespace agxTerrain
25 {
26  class Terrain;
27  class TerrainDataAtlas;
28 
31 
36  {
37  public:
42 
49 
50  /*
51  Set fluid mass in a voxel given an index
52  \param voxelIndex - The specified voxel index
53  \param fluidMass - the amount of fluid mass to set
54  */
55  void setFluidMass(const agx::Vec3i& voxelIndex, float fluidMass);
56 
63  float addFluidMass(const agx::Vec3i& voxelIndex, float fluidMass);
64 
71  float removeFluidMass(const agx::Vec3i& voxelIndex, float fluidMass);
72 
78  float getFluidMass(const agx::Vec3i& voxelIndex) const;
79 
90  float addSolidMass(const agx::Vec3i& voxelIndex, float solidMass, float compaction, float occupancyLimit = 1.0);
91 
99  float removeSolidMass(const agx::Vec3i& voxelIndex, float solidMass);
100 
107  void setSolidMass(const agx::Vec3i& voxelIndex, float solidMass, float compaction);
108 
114  float getSolidMass(const agx::Vec3i& voxelIndex) const;
115 
124  void setCompaction(const agx::Vec3i& voxelIndex, float compaction, bool scaleMass=false);
125 
131  float getCompaction(const agx::Vec3i& voxelIndex) const;
132 
138  float getParticleMass(const agx::Vec3i& voxelIndex) const;
139 
145  void setParticleMass(const agx::Vec3i& voxelIndex, float particleMass);
146 
153  float getCompactedSolidMass(const agx::Vec3i& voxelIndex) const;
154 
161  float addFluidMassToColumn(const agx::Vec2i& voxelIndexXY, float mass);
162 
169  float removeFluidMassFromColumn(const agx::Vec2i& voxelIndexXY, float mass);
170 
180  float addSolidMassToColumn(const agx::Vec2i& voxelIndexXY, float mass, float compaction, agx::Vec3i& newSurfaceVoxel);
181 
192  float addSolidMassToColumn(const agx::Vec3i& surfaceVoxelIndex, float mass, float compaction, agx::Vec3i& newSurfaceVoxel);
193 
202  float removeSolidMassFromColumn(const agx::Vec2i& voxelIndexXY, float mass, agx::Vec3i& newSurfaceVoxel);
203 
213  float removeSolidMassFromColumn(const agx::Vec3i& surfaceVoxelIndex, float mass, agx::Vec3i& newSurfaceVoxel);
214 
222  bool dilateMassInColumn(const agx::Vec3i& bottomVoxel, agx::Vec3i& newSurfaceVoxel);
223 
230  float convertCompactedSolidMassToNominal(const agx::Vec3i& voxelIndex, float compactedOccupancy) const;
231 
237  bool isTotalMassOverNominalThreshold(const agx::Vec3i& voxelIndex);
238 
246  bool verifyMassColumnIntegrity(const agx::Vec2i& voxelIndexXY);
247 
248  public:
252 
253  protected:
254 
255  virtual ~TerrainMassController();
256 
257  TerrainDataAtlas* getData() const;
258 
259  private:
260  Terrain* m_terrain;
261  };
262 }
#define AGXTERRAIN_STORE_RESTORE_INTERFACE
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacti...
Copyright 2007 - 2018.
Definition: Geometry.h:56
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
Base class providing referencing counted objects.
Definition: Referenced.h:113
Class that handles and sanity checks the mass logic in the terrain.
#define AGXTERRAIN_EXPORT
AGX_DECLARE_VECTOR_TYPES(ActiveZone)
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:102
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:101