AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TerrainVoxelDrawable.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 <agxOSG/export.h>
20 
21 #include <agxTerrain/Terrain.h>
23 
24 #include <agx/Task.h>
25 
26 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
27 #include <osg/Drawable>
28 #include <osg/Version>
29 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
30 
31 namespace agxOSG
32 {
36  class AGXOSG_EXPORT TerrainVoxelDrawable : public osg::Drawable
37  {
38  public:
40 
41  void setRenderVoxelSolidMass( bool enable );
42  bool getRenderVoxelSolidMass() const;
43 
44  void setRenderVoxelFluidMass( bool enable );
45  bool getRenderVoxelFluidMass() const;
46 
47  void setRenderVoxelBoundingBox( bool enable );
48  bool getRenderVoxelBoundingBox() const;
49 
50  void setRenderNodes( bool enable );
51  bool getRenderNodes() const;
52 
53  void setRenderCompaction( bool enable );
54  bool getRenderCompaction() const;
55 
56  void setRenderVelocityField( bool enable );
57  bool getRenderVelocityField() const;
58 
59  void setVelocityFieldLineColor(const agx::Vec4& lineColor);
60 
61  void setMaxVoxelValueColor(const agx::Vec4f& maxVoxelColor);
62 
66  bool hasEnabledFeatures() const;
67 
71  bool isInitialized() const;
72 
73  virtual osg::Object* cloneType() const { return new TerrainVoxelDrawable(m_terrain); }
74  virtual osg::Object* clone(const osg::CopyOp&) const { return new TerrainVoxelDrawable(*this); }
75  virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const TerrainVoxelDrawable *>(obj) != nullptr; }
76  virtual const char* libraryName() const { return "agxOSG"; }
77  virtual const char* className() const { return "TerrainVoxelDrawable"; }
78 
80 #if OSG_VERSION_GREATER_OR_EQUAL(3,4,0)
81  virtual osg::BoundingSphere computeBound() const;
82  virtual osg::BoundingBox computeBoundingBox() const;
83 #else
84  virtual osg::BoundingBox computeBound() const;
85 #endif
86 
88  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
89 
90  void updateDrawable();
91 
92  public:
93  void onAddNotification( agxSDK::Simulation* simulation );
94  void onRemoveNotification( agxSDK::Simulation* simulation );
95 
96  protected:
97  virtual ~TerrainVoxelDrawable();
98 
100  // Variables
102  protected:
104  osg::Group* m_group;
106  osg::ref_ptr<osgSim::ColorRange> m_colorRange;
107  bool m_enable;
108  float m_rScaling;
115 
121 
122  // Bounding box data
127 
128  // Velocity field data
132 
134  };
135 }
virtual osg::Object * clone(const osg::CopyOp &) const
#define AGXOSG_EXPORT
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacti...
agxTerrain::TerrainRendererRef m_renderer
virtual osg::Object * cloneType() const
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:34
virtual bool isSameKindAs(const osg::Object *obj) const
osg::ref_ptr< osgSim::ColorRange > m_colorRange
agxData::BufferRef m_voxelEnableRenderBuffer
Internal drawable class for drawing the Voxel grid structure.
virtual const char * className() const
virtual const char * libraryName() const
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:121
AGXBRICK_EXPORT bool isInitialized()
agxTerrain::TerrainRef m_terrain