17#ifndef AGXOSG_PRESSURE_RENDERER_H
18#define AGXOSG_PRESSURE_RENDERER_H
30#include <osg/observer_ptr>
31#include <osgSim/ColorRange>
67 osgSim::ColorRange* colorRange =
new osgSim::ColorRange(0.0f, 1.0e5f),
#define AGX_DECLARE_POINTER_TYPES(type)
The geometry representation used by the collision detection engine.
Triangle mesh for geometric intersection tests.
An utility class for handling of pressure rendering and legend.
agxOSG::PressureAtlasManagerRef m_atlasManager
virtual ~PressureRenderer()
agx::Vector< agxCollide::TrimeshRef > m_meshes
osg::ref_ptr< osgSim::ColorRange > m_colorRange
agx::Vec2 m_legendPosition
size_t stopMaxAvgRecording()
Stop the current recording.
agx::Vector< agxSDK::ExecuteFilterRef > m_filters
agxOSG::PressureAtlasManager * getPressureAtlasManager()
Gets the pressure atlas manager.
agx::Vector< MaxAvgRecordingVector > m_maxAvgRecordings
PressureRenderer(osg::Group *root, agxOSG::SceneDecorator *decorator, agxSDK::Simulation *simulation, const agx::Real minPressure, const agx::Real maxPressure, const agxRender::ColorVector &colors, const agx::Real texelsPerMeter=agx::Real(50), const agx::Real rangeFactor=agx::Real(2.0e-5), agxOSG::PressureFromContacts::ForceType forceType=agxOSG::PressureFromContacts::TOTAL_FORCE)
Constructor using agx data.
agx::Vector< MaxAvgRecording > MaxAvgRecordingVector
void unregisterRecorders()
const agxOSG::PressureFromContacts::ForceType m_forceType
PressureRenderer(osg::Group *root, agxOSG::SceneDecorator *decorator, agxSDK::Simulation *simulation, osgSim::ColorRange *colorRange=new osgSim::ColorRange(0.0f, 1.0e5f), const agx::Real texelsPerMeter=agx::Real(50), const agx::Real rangeFactor=agx::Real(2.0e-5), agxOSG::PressureFromContacts::ForceType forceType=agxOSG::PressureFromContacts::TOTAL_FORCE)
Constructor using osg color range directly.
bool renderPressure(size_t recording, bool useMax)
bool renderMaxPressure(size_t recording)
Replace the texture data for measured geometries with a recorded maximum pressure.
agx::Vector< MaxAvgData > m_maxAvgData
size_t getNumRecordings()
bool startMaxAvgRecording()
Start recording of maximum and average pressure for each pressure atlas currently owned by this Press...
size_t m_currentRecording
bool addGeometry(agxCollide::Geometry *geometry, bool keepGeometryNode=false)
Adds all shapes in a geometry to the pressure rendering.
bool restoreRendering()
Disable rendering of recorded maximum or average data.
void setEnableLegend(bool flag)
Enables/disables legend in HUD.
osg::observer_ptr< agxOSG::SceneDecorator > m_decorator
osg::observer_ptr< osg::Group > m_root
osg::ref_ptr< agxOSG::Transform > m_legendTransform
void addFilter(agxSDK::ExecuteFilter *filter)
Add a contact filter.
osgSim::ColorRange * getColorRange()
Gets the color range.
bool renderAvgPressure(size_t recording)
Replace the texture data for measured geometries with a recorded average pressure.
agx::Vec2 getLegendPosition() const
Returns the legend center position in relative screen space (0 to 1).
void setLegendPosition(const agx::Vec2 &pos)
Sets the legend center position in relative screen space (0 to 1).
bool addTrimesh(agxCollide::Trimesh *trimesh, bool keepGeometryNode=false)
Adds a trimesh to the pressure rendering.
Decorates a scene with a specific AGX Rendering Style.
Abstract base class that implements a filter that selects which events should trigger a Listener.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Base class providing referencing counted objects.
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
GatherAvgPressureRef avgGatherer
const agxCollide::TrimeshConstObserver mesh
GatherMaxPressureRef maxGatherer
MaxAvgData(const agxCollide::TrimeshConstObserver mesh, GatherMaxPressureRef maxGatherer, GatherAvgPressureRef avgGatherer, osg::Group *root)
osg::ref_ptr< osg::Image > originalTextureImage
osg::Texture2D * getTexture(osg::Group *root)
MaxAvgRecording(const MaxAvgData &data)
osg::Texture2D * getTexture(osg::Group *root)
const agxCollide::TrimeshConstObserver mesh
osg::ref_ptr< osg::Image > avgPressure
osg::ref_ptr< osg::Image > maxPressure
osg::ref_ptr< osg::Image > originalTextureImage