AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
agxOSG::TerrainVoxelRenderer Class Reference

Rendering class for the agxTerrain::Terrain. More...

#include <TerrainVoxelRenderer.h>

+ Inheritance diagram for agxOSG::TerrainVoxelRenderer:

Classes

struct  ContextData
 
struct  SoilParticleMeshData
 

Public Types

enum  RenderMode { DEPTH , COMPACTION }
 
- Public Types inherited from agxSDK::StepEventListener
enum  ActivationMask {
  STEP_NONE = 0x0 , PRE_COLLIDE = 0x1 , PRE_STEP = 0x2 , POST_STEP = 0x4 ,
  LAST_STEP = 0x8 , DEFAULT = PRE_STEP | POST_STEP , ALL = PRE_COLLIDE | PRE_STEP | POST_STEP | LAST_STEP
}
 Defines the event states for which a listener will be activated, a mask can be bitwise OR:ed from these members. More...
 
- Public Types inherited from agxSDK::EventListener
enum  Type { UNDEFINED_TYPE , STEP_EVENT_LISTENER , CONTACT_EVENT_LISTENER , GUI_EVENT_LISTENER }
 Type of EventListener. More...
 
- Public Types inherited from agx::Component
typedef Event2< Component *, Object * > ObjectEvent
 Event when adding removing child objects.
 
typedef Callback1< Object * > TraverseCallback
 
- Public Types inherited from agx::Object
typedef agx::observer_ptr< const EventEventConstObserver
 
typedef agx::ref_ptr< const EventEventConstRef
 
typedef agx::observer_ptr< EventEventObserver
 
typedef agx::Vector< EventObserverEventObserverVector
 
typedef agx::VectorPOD< Event * > EventPtrVector
 
typedef agx::ref_ptr< EventEventRef
 
typedef agx::Vector< EventRefEventRefVector
 

Public Member Functions

 TerrainVoxelRenderer (agxSDK::TerrainInstance *terrainInstance, osg::Group *group)
 Construct a TerrainVoxel renderer given a terrain instance and a visual root.
 
 TerrainVoxelRenderer (agxTerrain::Terrain *terrain, osg::Group *group)
 Construct a TerrainVoxel renderer given a terrain and a visual root.
 
virtual void addNotification () override
 Called when this listener is added to the simulation.
 
agx::Vec4f getColor () const
 
agxOSG::GeometryNodegetNode () const
 
bool getRenderCompaction () const
 
bool getRenderDefaultTerrainMaterial () const
 
bool getRenderHeightField () const
 
bool getRenderHeights () const
 
bool getRenderSoilParticles () const
 
bool getRenderSoilParticlesMesh () const
 
bool getRenderTerrainMaterials () const
 
bool getRenderVelocityField () const
 
bool getRenderVoxelBoundingBox () const
 
bool getRenderVoxelCompaction () const
 
bool getRenderVoxelFluidMass () const
 
bool getRenderVoxelSolidMass () const
 
const agx::StringgetSoilParticleMeshModelFilename () const
 
const agx::StringgetSoilParticleMeshTextureFilename () const
 
agxTerrain::TerraingetTerrain () const
 
agxRender::ColorVector getTerrainMaterialColors () const
 Get the color array to use when rendering different terrain materials.
 
virtual void last (const agx::TimeStamp &) override
 Called after a step is taken in the simulation Implement this method in the derived class to get callbacks.
 
virtual void removeNotification () override
 Called when this listener is removed from the simulation.
 
void setColor (agx::Vec4f color)
 Set color of the terrain.
 
void setMaxVoxelValueColor (const agx::Vec4f &maxVoxelColor)
 Assign max value color of velocity fields in the voxel renderer.
 
void setRenderCompaction (bool enable, agx::RangeReal compactionRange=agx::RangeReal(0.75, 1.5))
 Enable/disable rendering of compaction.
 
void setRenderDefaultTerrainMaterial (bool enable)
 Enable/disable rendering of the default terrain material during rendering of terrain materials (see setRenderTerrainMaterials).
 
void setRenderHeightField (bool enable)
 Enable/disable rendering of the terrain.
 
void setRenderHeights (bool enable, agx::RangeReal heightRange=agx::RangeReal(), bool useRelativeHeights=false, const osg::Vec4 &lowColor=osg::Vec4(0.0, 0.0, 1.0, 1.0), const osg::Vec4 &midColor=osg::Vec4(0.0, 1.0, 0.0, 1.0), const osg::Vec4 &highColor=osg::Vec4(1.0, 0.0, 0.0, 1.0))
 Enable/disable rendering of terrain height using a scalar color range.
 
void setRenderSoilParticles (bool enable)
 Enable/disable rendering of solid particles.
 
void setRenderSoilParticlesMesh (bool enable)
 Set enable render particles as triangle meshes.
 
void setRenderTerrainMaterials (bool enable)
 Enable/disable rendering of multiple terrain materials in the voxel grid.
 
void setRenderVelocityField (bool enable)
 Enable/disable rendering of the mass velocity field.
 
void setRenderVoxelBoundingBox (bool enable)
 Enable/disable rendering of voxel bounding boxes.
 
void setRenderVoxelCompaction (bool enable)
 Enable/disable rendering of compaction in the voxel grid.
 
void setRenderVoxelFluidMass (bool enable)
 Enable/disable rendering of fluid mass.
 
void setRenderVoxelSolidMass (bool enable)
 Enable/disable rendering of solid mass.
 
void setSoilParticleMeshData (const agx::String &modelFilename, const agx::String &textureFilename="")
 Load soil particle mesh model and texture (optional).
 
void setTerrainMaterialsColors (const agxRender::ColorVector &colors)
 Set the color array to use when rendering different terrain materials.
 
void setVelocityFieldLineColor (const agx::Vec4 &lineColor)
 Assign line color of velocity fields in the voxel renderer.
 
- Public Member Functions inherited from agxSDK::StepEventListener
 StepEventListener (int mask=DEFAULT)
 Default constructor, sets the default activation mask to all (POST_STEP and PRE_STEP) events.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agxSDK::StepEventListener)
 
virtual void last (const agx::TimeStamp &time)
 Called after a step is taken in the simulation Implement this method in the derived class to get callbacks.
 
virtual void post (const agx::TimeStamp &time)
 Called after a step is taken in the simulation Implement this method in the derived class to get callbacks.
 
virtual void pre (const agx::TimeStamp &time)
 Called before a step is taken in the simulation Implement this method in the derived class to get callbacks.
 
virtual void preCollide (const agx::TimeStamp &time)
 Called before collision detection is performed in the simulation Implement this method in the derived class to get callbacks.
 
virtual void setMask (int mask) override
 Specifies a bitmask which determines which event types will activate this listener.
 
- Public Member Functions inherited from agxSDK::EventListener
virtual void addNotification ()
 Called when this listener is added to the simulation.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agxSDK::EventListener)
 
int getMask () const
 
agx::UInt32 getPriority () const
 
SimulationgetSimulation ()
 
const SimulationgetSimulation () const
 
Type getType () const
 
bool isEnabled () const
 
virtual void removeNotification ()
 Called when this listener is removed from the simulation.
 
void setEnable (bool enable)
 Specify whether the listener should react at all at events.
 
virtual void setMask (int f)
 Specifies a bit mask which determines which event types that will activate this listener.
 
- Public Member Functions inherited from agx::Component
 Component (const agx::Name &name=agx::Name(), agx::Model *model=agx::Component::ClassModel(), agx::Device *device=nullptr)
 
virtual void addObject (agx::Object *object, bool assignContext=true)
 Add an object to the component.
 
virtual String autoComplete (const String &partialName, StringVector &matchingNames) const
 
virtual void buildNavigationTree (agxJson::Value &eNode) const override
 
void configure (Model *model)
 
virtual void configure (TiXmlElement *eComponent) override
 
agx::DevicegetDevice ()
 
template<typename T >
T * getDevice ()
 
const agx::DevicegetDevice () const
 
template<typename T >
const T * getDevice () const
 
size_t getNumObjects (const agx::Name &name) const
 
agx::ObjectgetObject (const agx::Name &name, agx::Model *model, size_t index=0)
 
const agx::ObjectgetObject (const agx::Name &name, agx::Model *model, size_t index=0) const
 
agx::ObjectgetObject (const agx::Name &name, size_t index=0)
 
template<typename T >
T * getObject (const agx::Name &name, size_t index=0)
 
const agx::ObjectgetObject (const agx::Name &name, size_t index=0) const
 
template<typename T >
const T * getObject (const agx::Name &name, size_t index=0) const
 
const agx::ObjectRefVectorgetObjects () const
 
template<typename T >
void getObjects (agx::ObjectPtrVector &result, bool recursive=false) const
 Returns All child objects of a specified type in the result container.
 
void getObjects (agx::ObjectPtrVector &result, const agx::Model *model, bool recursive=false) const
 
virtual ObjectgetResourceImpl (const Path &path, agx::Model *model) override
 
virtual void printSubtree () const override
 
void printSubtree (std::ostream &stream, int depth=0) const
 
virtual void rebind () override
 
void removeAllObjects ()
 Remove all components.
 
virtual void removeObject (agx::Object *object)
 Remove an object from the component.
 
void removeObject (const agx::Name &name, size_t index=0)
 Remove an object with a specified name (and optional index) from the component.
 
virtual void snapshot (TiXmlNode *eParent, const String &directory) const override
 
void traverse (ComponentVisitor *)
 
void traverse (const TraverseCallback &callback)
 
- Public Member Functions inherited from agx::Object
 Object (const Name &name=Name(), Model *model=Object::ClassModel())
 
void addListener (EventListener *listener)
 
virtual void buildNavigationTree (agxJson::Value &eNode) const
 
virtual void configure (TiXmlElement *)
 
agx::String fullName () const
 
agx::String fullPath () const
 
agx::String fullPath (const agx::Object *root) const
 
template<typename T >
T * getAutoScopedResource (const agx::Path &path)
 
template<typename T >
const T * getAutoScopedResource (const agx::Path &path) const
 
agx::ObjectgetAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::ObjectgetAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) const
 
agx::ObjectgetContext ()
 
template<typename T >
T * getContext ()
 
const agx::ObjectgetContext () const
 
template<typename T >
const T * getContext () const
 
agx::UInt32 getId () const
 
const agx::NamegetImplementationName () const
 
agx::ModelgetModel ()
 
const agx::ModelgetModel () const
 
const agx::NamegetName () const
 
agx::ObjectgetNextSibling ()
 
const agx::ObjectgetNextSibling () const
 
agx::Path getPath () const
 
agx::Path getPath (const agx::Object *root) const
 
template<typename T >
T * getResource (const agx::Path &path)
 
template<typename T >
const T * getResource (const agx::Path &path) const
 
agx::ObjectgetResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::ObjectgetResource (const agx::Path &path, agx::Model *model=nullptr) const
 
virtual agx::ObjectgetResourceImpl (const agx::Path &path, agx::Model *model)
 
agx::ObjectgetRootContext ()
 
const agx::ObjectgetRootContext () const
 
bool hasListener (EventListener *listener)
 
bool hasParent (const agx::Object *node) const
 
bool isUnique () const
 
virtual void printSubtree () const
 
virtual void rebind ()
 
void removeListener (EventListener *listener)
 
virtual void save (TiXmlElement *) const
 
virtual void setContext (agx::Object *context)
 
void setId (UInt32 id)
 
void setModel (agx::Model *model)
 Set the object model (handled automatically).
 
void setName (const agx::Name &name)
 Set the name of the object.
 
virtual void snapshot (TiXmlNode *, const String &) const
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referencedoperator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Static Public Member Functions

static TerrainVoxelRendererfind (const agxTerrain::Terrain *terrain, const agxSDK::Simulation *simulation)
 Finds terrain renderer given terrain and simulation.
 
- Static Public Member Functions inherited from agxSDK::StepEventListener
static agxStream::Serializablecreate (agxStream::InputArchive &)
 
- Static Public Member Functions inherited from agxSDK::EventListener
static agxStream::Serializablecreate (agxStream::InputArchive &)
 
- Static Public Member Functions inherited from agx::Component
static Component_load (TiXmlElement *eComponent, Device *device)
 
static agx::ModelClassModel ()
 
static Componentload (const Path &path, const Name &implementation, Device *device, const Path &_namespace=Path())
 
static Componentload (const String &path, const Path &_namespace=Path())
 
static Componentload (const String &path, Device *device, const Path &_namespace=Path())
 
static Componentload (TiXmlElement *eComponent, Device *device)
 
- Static Public Member Functions inherited from agx::Object
static agx::ModelClassModel ()
 
static agx::String generateName (const agx::String &bindPath)
 
static const HashSet< Object * > & getActiveObjects ()
 
static bool getEnableRebind ()
 Should rebinding be allowed? Right now a global setting.
 
static Objectload (const String &path, Device *device, const String &type, const String &attribute, const String &value)
 
template<typename T >
static T * load (const String &path, Device *device, const String &type, const String &attribute, const String &value)
 
static Objectload (const String &path, Device *device, const String &type="", size_t instance=0)
 
template<typename T >
static T * load (const String &path, Device *device, const String &type="", size_t instance=0)
 
static void load (const String &path, Device *device, ObjectPtrVector &loadedObjects)
 
static Objectload (TiXmlElement *eObject, Device *device)
 
template<typename T >
static T * load (TiXmlElement *eObject, Device *device)
 
static TiXmlDocument openDocument (const String &path)
 
static void setEnableRebind (bool flag)
 Sets if rebinding of objects should be allowed (Right now a global setting).
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 

Protected Member Functions

virtual ~TerrainVoxelRenderer ()
 
- Protected Member Functions inherited from agxSDK::StepEventListener
virtual ~StepEventListener ()
 Destructor.
 
- Protected Member Functions inherited from agxSDK::EventListener
 EventListener (Type type=UNDEFINED_TYPE)
 Default constructor.
 
virtual ~EventListener ()
 Destructor.
 
void setSimulation (Simulation *simulation)
 Set the associated simulation for this EventListener.
 
- Protected Member Functions inherited from agx::Component
virtual ~Component ()
 
String expandAutoCompletionMatch (const String &query, const StringVector &matchingNames) const
 
void setDevice (Device *device)
 
- Protected Member Functions inherited from agx::Object
virtual ~Object ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Protected Attributes

osg::Vec4 m_color
 
ContextData m_heightsContextData
 
std::vector< agx::Realm_originalHeights
 
osg::ref_ptr< SoilParticleSystemDrawablem_soilParticleDrawable
 
SoilParticleMeshData m_soilParticleMeshData
 
ContextData m_surfaceContextData
 
agxTerrain::TerrainObserver m_terrain
 
bool m_useRelativeHeights = false
 
osg::ref_ptr< TerrainVoxelDrawable > m_voxelDrawable
 
- Protected Attributes inherited from agxSDK::EventListener
bool m_enabled
 
int m_mask
 
agx::UInt32 m_priority
 
Type m_type
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Additional Inherited Members

- Public Attributes inherited from agx::Component
ObjectEvent addObjectEvent
 
ObjectEvent removeObjectEvent
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandlergetDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 

Detailed Description

Rendering class for the agxTerrain::Terrain.

Definition at line 47 of file TerrainVoxelRenderer.h.

Member Enumeration Documentation

◆ RenderMode

Enumerator
DEPTH 
COMPACTION 

Definition at line 57 of file TerrainVoxelRenderer.h.

Constructor & Destructor Documentation

◆ TerrainVoxelRenderer() [1/2]

agxOSG::TerrainVoxelRenderer::TerrainVoxelRenderer ( agxTerrain::Terrain terrain,
osg::Group *  group 
)

Construct a TerrainVoxel renderer given a terrain and a visual root.

Parameters
terrain- terrain to render
group- render group the terrain should be part of. It cannot be null.

◆ TerrainVoxelRenderer() [2/2]

agxOSG::TerrainVoxelRenderer::TerrainVoxelRenderer ( agxSDK::TerrainInstance terrainInstance,
osg::Group *  group 
)

Construct a TerrainVoxel renderer given a terrain instance and a visual root.

Parameters
terrainInstance- terrain instance to render
group- render group the terrain should be part of. It cannot be null.

◆ ~TerrainVoxelRenderer()

virtual agxOSG::TerrainVoxelRenderer::~TerrainVoxelRenderer ( )
protectedvirtual

Member Function Documentation

◆ addNotification()

virtual void agxOSG::TerrainVoxelRenderer::addNotification ( )
overridevirtual

Called when this listener is added to the simulation.

(given that it not already is in the simulation).

Reimplemented from agxSDK::EventListener.

◆ find()

static TerrainVoxelRenderer * agxOSG::TerrainVoxelRenderer::find ( const agxTerrain::Terrain terrain,
const agxSDK::Simulation simulation 
)
static

Finds terrain renderer given terrain and simulation.

Returns
terrain renderer if exist, otherwise nullptr

◆ getColor()

agx::Vec4f agxOSG::TerrainVoxelRenderer::getColor ( ) const
Returns
current color of the terrain

◆ getNode()

agxOSG::GeometryNode * agxOSG::TerrainVoxelRenderer::getNode ( ) const
Returns
the geometry node if valid, otherwise nullptr

◆ getRenderCompaction()

bool agxOSG::TerrainVoxelRenderer::getRenderCompaction ( ) const
Returns
true if enabled, otherwise false

◆ getRenderDefaultTerrainMaterial()

bool agxOSG::TerrainVoxelRenderer::getRenderDefaultTerrainMaterial ( ) const
Returns
true if enabled, otherwise false.

◆ getRenderHeightField()

bool agxOSG::TerrainVoxelRenderer::getRenderHeightField ( ) const
Returns
true if enabled, otherwise false.

◆ getRenderHeights()

bool agxOSG::TerrainVoxelRenderer::getRenderHeights ( ) const
Returns
true if enabled, otherwise false

◆ getRenderSoilParticles()

bool agxOSG::TerrainVoxelRenderer::getRenderSoilParticles ( ) const
Returns
true if enabled, otherwise false

◆ getRenderSoilParticlesMesh()

bool agxOSG::TerrainVoxelRenderer::getRenderSoilParticlesMesh ( ) const
Returns
true if enabled, otherwise false

◆ getRenderTerrainMaterials()

bool agxOSG::TerrainVoxelRenderer::getRenderTerrainMaterials ( ) const
Returns
true if enabled, otherwise false.

◆ getRenderVelocityField()

bool agxOSG::TerrainVoxelRenderer::getRenderVelocityField ( ) const
Returns
true if enabled, otherwise false

◆ getRenderVoxelBoundingBox()

bool agxOSG::TerrainVoxelRenderer::getRenderVoxelBoundingBox ( ) const
Returns
true if enabled, otherwise false

◆ getRenderVoxelCompaction()

bool agxOSG::TerrainVoxelRenderer::getRenderVoxelCompaction ( ) const
Returns
true if enabled, otherwise false.

◆ getRenderVoxelFluidMass()

bool agxOSG::TerrainVoxelRenderer::getRenderVoxelFluidMass ( ) const
Returns
true if enabled, otherwise false

◆ getRenderVoxelSolidMass()

bool agxOSG::TerrainVoxelRenderer::getRenderVoxelSolidMass ( ) const
Returns
true if enabled, otherwise false

◆ getSoilParticleMeshModelFilename()

const agx::String & agxOSG::TerrainVoxelRenderer::getSoilParticleMeshModelFilename ( ) const
Returns
model filename currently in use when rendering soil particles as mesh

◆ getSoilParticleMeshTextureFilename()

const agx::String & agxOSG::TerrainVoxelRenderer::getSoilParticleMeshTextureFilename ( ) const
Returns
model texture filename currently in use when rendering soil particles as mesh

◆ getTerrain()

agxTerrain::Terrain * agxOSG::TerrainVoxelRenderer::getTerrain ( ) const
Returns
the terrain

◆ getTerrainMaterialColors()

agxRender::ColorVector agxOSG::TerrainVoxelRenderer::getTerrainMaterialColors ( ) const

Get the color array to use when rendering different terrain materials.

◆ last()

virtual void agxOSG::TerrainVoxelRenderer::last ( const agx::TimeStamp time)
overridevirtual

Called after a step is taken in the simulation Implement this method in the derived class to get callbacks.

Note
In this call, the simulation time is the new updated time.
Parameters
time- The new updated simulation time incremented by the time step.

Reimplemented from agxSDK::StepEventListener.

◆ removeNotification()

virtual void agxOSG::TerrainVoxelRenderer::removeNotification ( )
overridevirtual

Called when this listener is removed from the simulation.

Reimplemented from agxSDK::EventListener.

◆ setColor()

void agxOSG::TerrainVoxelRenderer::setColor ( agx::Vec4f  color)

Set color of the terrain.

Parameters
color- color

◆ setMaxVoxelValueColor()

void agxOSG::TerrainVoxelRenderer::setMaxVoxelValueColor ( const agx::Vec4f maxVoxelColor)

Assign max value color of velocity fields in the voxel renderer.

Parameters
maxVoxelColor- max voxel color

◆ setRenderCompaction()

void agxOSG::TerrainVoxelRenderer::setRenderCompaction ( bool  enable,
agx::RangeReal  compactionRange = agx::RangeReal(0.75, 1.5) 
)

Enable/disable rendering of compaction.

Parameters
enable- true to enable, false to disable
compactionRange- min and max compaction

◆ setRenderDefaultTerrainMaterial()

void agxOSG::TerrainVoxelRenderer::setRenderDefaultTerrainMaterial ( bool  enable)

Enable/disable rendering of the default terrain material during rendering of terrain materials (see setRenderTerrainMaterials).

Default: Enabled.

Parameters
enable- true to enable, false to disable.

◆ setRenderHeightField()

void agxOSG::TerrainVoxelRenderer::setRenderHeightField ( bool  enable)

Enable/disable rendering of the terrain.

Default: Enabled.

Parameters
enable- true to enable, false to disable

◆ setRenderHeights()

void agxOSG::TerrainVoxelRenderer::setRenderHeights ( bool  enable,
agx::RangeReal  heightRange = agx::RangeReal(),
bool  useRelativeHeights = false,
const osg::Vec4 &  lowColor = osg::Vec4(0.0, 0.0, 1.0, 1.0),
const osg::Vec4 &  midColor = osg::Vec4(0.0, 1.0, 0.0, 1.0),
const osg::Vec4 &  highColor = osg::Vec4(1.0, 0.0, 0.0, 1.0) 
)

Enable/disable rendering of terrain height using a scalar color range.

If enabled and heightRange is default (-inf, inf), the scalar range is estimated from the current terrain state.

If useRelativeHeights is false, colors are based on absolute terrain heights. If useRelativeHeights is true, colors are based on height differences relative to the terrain heights captured the first time relative-height rendering is enabled.

The three colors define the low, middle, and high colors of the scalar range. With the default colors, low values are blue, middle values are green, and high values are red.

The middle color corresponds to the midpoint of heightRange, not necessarily to scalar value zero unless the range is symmetric around zero.

Parameters
enable- true to enable, false to disable
heightRange- scalar range defining the low and high values used for color interpolation. If default (-inf, inf), the range is estimated from the current terrain state.
useRelativeHeights- if true, colors are based on relative height differences between the current terrain and the terrain heights captured the first time relative-height rendering is enabled. If false, colors are based on absolute terrain heights.
lowColor- color used for the low end of the scalar range
midColor- color used for the midpoint of the scalar range
highColor- color used for the high end of the scalar range

◆ setRenderSoilParticles()

void agxOSG::TerrainVoxelRenderer::setRenderSoilParticles ( bool  enable)

Enable/disable rendering of solid particles.

Default: False.

Parameters
enable- true to enable, false to disable

◆ setRenderSoilParticlesMesh()

void agxOSG::TerrainVoxelRenderer::setRenderSoilParticlesMesh ( bool  enable)

Set enable render particles as triangle meshes.

Default: True.

Parameters
enable- true to enable, false to disable

◆ setRenderTerrainMaterials()

void agxOSG::TerrainVoxelRenderer::setRenderTerrainMaterials ( bool  enable)

Enable/disable rendering of multiple terrain materials in the voxel grid.

Default: Disabled.

Parameters
enable- true to enable, false to disable.

◆ setRenderVelocityField()

void agxOSG::TerrainVoxelRenderer::setRenderVelocityField ( bool  enable)

Enable/disable rendering of the mass velocity field.

Default: Disabled.

Parameters
enable- true to enable, false to disable

◆ setRenderVoxelBoundingBox()

void agxOSG::TerrainVoxelRenderer::setRenderVoxelBoundingBox ( bool  enable)

Enable/disable rendering of voxel bounding boxes.

Default: Disabled.

Parameters
enable- true to enable, false to disable

◆ setRenderVoxelCompaction()

void agxOSG::TerrainVoxelRenderer::setRenderVoxelCompaction ( bool  enable)

Enable/disable rendering of compaction in the voxel grid.

Default: Disabled.

Parameters
enable- true to enable, false to disable.

◆ setRenderVoxelFluidMass()

void agxOSG::TerrainVoxelRenderer::setRenderVoxelFluidMass ( bool  enable)

Enable/disable rendering of fluid mass.

Default: Disabled.

Parameters
enable- true to enable, false to disable

◆ setRenderVoxelSolidMass()

void agxOSG::TerrainVoxelRenderer::setRenderVoxelSolidMass ( bool  enable)

Enable/disable rendering of solid mass.

Default: Disabled.

Parameters
enable- true to enable, false to disable

◆ setSoilParticleMeshData()

void agxOSG::TerrainVoxelRenderer::setSoilParticleMeshData ( const agx::String modelFilename,
const agx::String textureFilename = "" 
)

Load soil particle mesh model and texture (optional).

Parameters
modelFilename- model filename and including relative path and optional translate and scale ("model.obj.[2, 2, 2].scale.[0, 1, 2].trans"

◆ setTerrainMaterialsColors()

void agxOSG::TerrainVoxelRenderer::setTerrainMaterialsColors ( const agxRender::ColorVector colors)

Set the color array to use when rendering different terrain materials.

◆ setVelocityFieldLineColor()

void agxOSG::TerrainVoxelRenderer::setVelocityFieldLineColor ( const agx::Vec4 lineColor)

Assign line color of velocity fields in the voxel renderer.

Parameters
lineColor- line color

Member Data Documentation

◆ m_color

osg::Vec4 agxOSG::TerrainVoxelRenderer::m_color
protected

Definition at line 349 of file TerrainVoxelRenderer.h.

◆ m_heightsContextData

ContextData agxOSG::TerrainVoxelRenderer::m_heightsContextData
protected

Definition at line 348 of file TerrainVoxelRenderer.h.

◆ m_originalHeights

std::vector<agx::Real> agxOSG::TerrainVoxelRenderer::m_originalHeights
protected

Definition at line 354 of file TerrainVoxelRenderer.h.

◆ m_soilParticleDrawable

osg::ref_ptr<SoilParticleSystemDrawable> agxOSG::TerrainVoxelRenderer::m_soilParticleDrawable
protected

Definition at line 351 of file TerrainVoxelRenderer.h.

◆ m_soilParticleMeshData

SoilParticleMeshData agxOSG::TerrainVoxelRenderer::m_soilParticleMeshData
protected

Definition at line 352 of file TerrainVoxelRenderer.h.

◆ m_surfaceContextData

ContextData agxOSG::TerrainVoxelRenderer::m_surfaceContextData
protected

Definition at line 347 of file TerrainVoxelRenderer.h.

◆ m_terrain

agxTerrain::TerrainObserver agxOSG::TerrainVoxelRenderer::m_terrain
protected

Definition at line 346 of file TerrainVoxelRenderer.h.

◆ m_useRelativeHeights

bool agxOSG::TerrainVoxelRenderer::m_useRelativeHeights = false
protected

Definition at line 353 of file TerrainVoxelRenderer.h.

◆ m_voxelDrawable

osg::ref_ptr<TerrainVoxelDrawable> agxOSG::TerrainVoxelRenderer::m_voxelDrawable
protected

Definition at line 350 of file TerrainVoxelRenderer.h.


The documentation for this class was generated from the following file: