|
AGX Dynamics 2.42.3.1
|
An utility class for handling of pressure rendering and legend. More...
#include <PressureRenderer.h>
Inheritance diagram for agxOSG::PressureRenderer:Classes | |
| struct | MaxAvgData |
| struct | MaxAvgRecording |
Public Member Functions | |
| 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. | |
| 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. | |
| void | addFilter (agxSDK::ExecuteFilter *filter) |
| Add a contact filter. | |
| bool | addGeometry (agxCollide::Geometry *geometry, bool keepGeometryNode=false) |
| Adds all shapes in a geometry to the pressure rendering. | |
| bool | addTrimesh (agxCollide::Trimesh *trimesh, bool keepGeometryNode=false) |
| Adds a trimesh to the pressure rendering. | |
| osgSim::ColorRange * | getColorRange () |
| Gets the color range. | |
| agx::Vec2 | getLegendPosition () const |
| Returns the legend center position in relative screen space (0 to 1). | |
| size_t | getNumRecordings () |
| agxOSG::PressureAtlasManager * | getPressureAtlasManager () |
| Gets the pressure atlas manager. | |
| bool | isRecording () |
| bool | renderAvgPressure (size_t recording) |
| Replace the texture data for measured geometries with a recorded average pressure. | |
| bool | renderMaxPressure (size_t recording) |
| Replace the texture data for measured geometries with a recorded maximum pressure. | |
| bool | restoreRendering () |
| Disable rendering of recorded maximum or average data. | |
| void | setEnableLegend (bool flag) |
| Enables/disables legend in HUD. | |
| void | setLegendPosition (const agx::Vec2 &pos) |
| Sets the legend center position in relative screen space (0 to 1). | |
| bool | startMaxAvgRecording () |
| Start recording of maximum and average pressure for each pressure atlas currently owned by this PressureRenderer. | |
| size_t | stopMaxAvgRecording () |
| Stop the current recording. | |
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. | |
| Referenced & | operator= (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. | |
Protected Types | |
| typedef agx::Vector< MaxAvgRecording > | MaxAvgRecordingVector |
Protected Member Functions | |
| virtual | ~PressureRenderer () |
| bool | renderPressure (size_t recording, bool useMax) |
| void | unregisterRecorders () |
| void | updateTextureData () |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Protected Attributes | |
| agxOSG::PressureAtlasManagerRef | m_atlasManager |
| osg::ref_ptr< osgSim::ColorRange > | m_colorRange |
| size_t | m_currentRecording |
| osg::observer_ptr< agxOSG::SceneDecorator > | m_decorator |
| agx::Vector< agxSDK::ExecuteFilterRef > | m_filters |
| const agxOSG::PressureFromContacts::ForceType | m_forceType |
| agx::Vec2 | m_legendPosition |
| osg::ref_ptr< agxOSG::Transform > | m_legendTransform |
| agx::Vector< MaxAvgData > | m_maxAvgData |
| agx::Vector< MaxAvgRecordingVector > | m_maxAvgRecordings |
| agx::Vector< agxCollide::TrimeshRef > | m_meshes |
| agx::Real | m_rangeFactor |
| osg::observer_ptr< osg::Group > | m_root |
Protected Attributes inherited from agx::Referenced | |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
Additional Inherited Members | |
Static Public Member Functions inherited from agx::Referenced | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Static Protected Member Functions inherited from agx::Referenced | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. | |
An utility class for handling of pressure rendering and legend.
Definition at line 50 of file PressureRenderer.h.
|
protected |
Definition at line 281 of file PressureRenderer.h.
| agxOSG::PressureRenderer::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.
| root | The scene root. |
| decorator | The scene decorator, used here for the hud-legend. |
| simulation | The simulation |
| colorRange | The color range, containing colors, and min and max pressure. |
| texelsPerMeter | The amount of texels per length unit (meter) |
| rangeFactor | Relationship between a contact force and area of the pressure circle. In m/N. |
| forceType | The type of the force to add. Tangential (friction) only, normal only, or both. |
| agxOSG::PressureRenderer::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.
| root | The scene root. |
| decorator | The scene decorator, used here for the hud-legend. |
| simulation | The simulation |
| minPressure | The min pressure for texturing |
| maxPressure | The max pressure for texturing |
| colors | A vector of colors for coloring. See osgSim::ColorRange for details. |
| texelsPerMeter | The amount of texels per length unit (meter) |
| rangeFactor | Relationship between a contact force and area of the pressure circle. In m/N. |
| forceType | The type of the force to add. Tangential (friction) only, normal only, or both. |
|
protectedvirtual |
| void agxOSG::PressureRenderer::addFilter | ( | agxSDK::ExecuteFilter * | filter | ) |
Add a contact filter.
A contact will only contribute pressure if it is accepted by all filters. Filters will only affect meshes and geometries which have been added after the filter has been added.
| filter |
| bool agxOSG::PressureRenderer::addGeometry | ( | agxCollide::Geometry * | geometry, |
| bool | keepGeometryNode = false |
||
| ) |
Adds all shapes in a geometry to the pressure rendering.
| geometry | The geometry. |
| keepGeometryNode | Should existing geometry nodes be kept? Interesting when blending render states. |
| bool agxOSG::PressureRenderer::addTrimesh | ( | agxCollide::Trimesh * | trimesh, |
| bool | keepGeometryNode = false |
||
| ) |
Adds a trimesh to the pressure rendering.
The trimesh's geometry has to be part of the simulation, and have an osg-node which is in the root's tree.
| trimesh | The trimesh. |
| keepGeometryNode | Should existing geometry nodes be kept? Interesting when blending render states. |
| osgSim::ColorRange * agxOSG::PressureRenderer::getColorRange | ( | ) |
Gets the color range.
| agx::Vec2 agxOSG::PressureRenderer::getLegendPosition | ( | ) | const |
Returns the legend center position in relative screen space (0 to 1).
| size_t agxOSG::PressureRenderer::getNumRecordings | ( | ) |
| agxOSG::PressureAtlasManager * agxOSG::PressureRenderer::getPressureAtlasManager | ( | ) |
Gets the pressure atlas manager.
| bool agxOSG::PressureRenderer::isRecording | ( | ) |
| bool agxOSG::PressureRenderer::renderAvgPressure | ( | size_t | recording | ) |
Replace the texture data for measured geometries with a recorded average pressure.
Each measured trimesh must be part of a geometry rendered using the OSG mesh created by the owning PressureAtlas, and the geometry must have an associated texture.
Will change the osg::Image object held by the osg::Texture2D object that is part of the OSG render tree.
| recording | The recording ID from which the average pressure should be fetched. |
| bool agxOSG::PressureRenderer::renderMaxPressure | ( | size_t | recording | ) |
Replace the texture data for measured geometries with a recorded maximum pressure.
Each measured trimesh must be part of a geometry rendered using the OSG mesh created by the owning PressureAtlas, and the geometry must have an associated texture.
Will change the osg::Image object held by the osg::Texture2D object that is part of the OSG render tree.
| recording | The recording ID from which the maximum pressure should be fetched. |
|
protected |
| bool agxOSG::PressureRenderer::restoreRendering | ( | ) |
Disable rendering of recorded maximum or average data.
Each texture will be returned the osg::Image object it held when the recording started.
| void agxOSG::PressureRenderer::setEnableLegend | ( | bool | flag | ) |
Enables/disables legend in HUD.
| void agxOSG::PressureRenderer::setLegendPosition | ( | const agx::Vec2 & | pos | ) |
Sets the legend center position in relative screen space (0 to 1).
| bool agxOSG::PressureRenderer::startMaxAvgRecording | ( | ) |
Start recording of maximum and average pressure for each pressure atlas currently owned by this PressureRenderer.
Should not be called while a recording is already in progress.
| size_t agxOSG::PressureRenderer::stopMaxAvgRecording | ( | ) |
Stop the current recording.
An ID for the recording is returned. The recorded data can be rendered on the geometries using 'renderMaxPressure(ID)' or 'renderAvgPressure(ID)'.
Should only be called while recording.
|
protected |
|
protected |
|
protected |
Definition at line 235 of file PressureRenderer.h.
|
protected |
Definition at line 236 of file PressureRenderer.h.
|
protected |
Definition at line 287 of file PressureRenderer.h.
|
protected |
Definition at line 234 of file PressureRenderer.h.
|
protected |
Definition at line 240 of file PressureRenderer.h.
|
protected |
Definition at line 290 of file PressureRenderer.h.
|
protected |
Definition at line 238 of file PressureRenderer.h.
|
protected |
Definition at line 237 of file PressureRenderer.h.
|
protected |
Definition at line 261 of file PressureRenderer.h.
|
protected |
Definition at line 284 of file PressureRenderer.h.
|
protected |
Definition at line 232 of file PressureRenderer.h.
|
protected |
Definition at line 239 of file PressureRenderer.h.
|
protected |
Definition at line 233 of file PressureRenderer.h.