|
AGX Dynamics 2.42.3.1
|
A pressure map for a single trimesh. More...
#include <PressureAtlas.h>
Inheritance diagram for agxOSG::PressureAtlas:Public Member Functions | |
| PressureAtlas (const agxCollide::Trimesh *mesh, agx::Real texelsPerMeter) | |
| void | addPressure (const agx::Vec3 &point, agx::UInt32 triangleIndex, agx::Real magnitude, agx::Real radius) |
| Add a pressure sphere centered at 'point', given in the mesh's coordinate system, The given 'magnitude' is the pressure at the given 'point'. | |
| void | clearPressure () |
| Fill the pressure map with zeros. | |
| agxOSG::GeometryNode * | createAtlasRendering () |
| osg::Geometry * | getGraphicsMesh () |
| Returns an OSG Geometry that can be used to render the collected pressure. | |
| size_t | getNumTriangles () const |
| size_t | getNumVertices () const |
| const agxCollide::Trimesh * | getPhysicsMesh () |
| osg::Image * | getPressureMap () |
| Returns the pressure map. | |
| osg::Vec2Array & | getTextureCoordinates () |
| size_t | getVertexIndex (size_t triangleIndex, size_t localVertexIndex) const |
| bool | isDirty () const |
| Check if the pressure map is dirty. | |
| bool | isPressurized () const |
| Check if the pressure map is pressurized. | |
| bool | registerColorConverter (agxOSG::PressureToColorConverter *colorConverter) |
| Make the given color converter perform color conversion on this atlas' pressure map when PressureAtlas::updateColorImages is called. | |
| bool | registerPressureGenerator (agxOSG::PressureGenerator *generator) |
| Let this PressureAtlas take over overship of the given pressure generator. | |
| bool | unregisterColorConverter (agxOSG::PressureToColorConverter *colorConverter) |
| Cause the given color converter to no longer receive update calls from PressureAtlas::updateColorImages. | |
| void | updateColorImages () |
| Trigger a color conversion on all converters, if the pressure map is dirty. | |
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 Member Functions | |
| virtual | ~PressureAtlas () |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
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. | |
Protected Attributes inherited from agx::Referenced | |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
A pressure map for a single trimesh.
Holds both the AGX trimesh used for simulation and a corresponding OSG geometry used for rendering, as well as a 32-bit floating-point image for the pressure data itself.
Definition at line 43 of file PressureAtlas.h.
| agxOSG::PressureAtlas::PressureAtlas | ( | const agxCollide::Trimesh * | mesh, |
| agx::Real | texelsPerMeter | ||
| ) |
|
inlineprotectedvirtual |
Definition at line 175 of file PressureAtlas.h.
| void agxOSG::PressureAtlas::addPressure | ( | const agx::Vec3 & | point, |
| agx::UInt32 | triangleIndex, | ||
| agx::Real | magnitude, | ||
| agx::Real | radius | ||
| ) |
Add a pressure sphere centered at 'point', given in the mesh's coordinate system, The given 'magnitude' is the pressure at the given 'point'.
The added pressure will decrease linearly with distance from 'point' to reaches zero for points at or beyond 'radius' distance from 'point'.
The point should be on the triangle with the given triangle index.
Will mark the atlas as dirty and pressurized if the magnitude is non-zero.
| point | The point, in mesh coordinates, where the pressure originates. |
| triangleIndex | The index of the triangle on which the point is located. |
| magnitude | The pressure at the point, given in Pa. Must be non-negative. |
| radius | The radius of the sphere which should be given a pressure contribution. Must be positive. |
| void agxOSG::PressureAtlas::clearPressure | ( | ) |
Fill the pressure map with zeros.
Set the dirty flag and clear the pressurized flag.
| agxOSG::GeometryNode * agxOSG::PressureAtlas::createAtlasRendering | ( | ) |
| osg::Geometry * agxOSG::PressureAtlas::getGraphicsMesh | ( | ) |
Returns an OSG Geometry that can be used to render the collected pressure.
Contains texture coordinates into the pressure map.
| size_t agxOSG::PressureAtlas::getNumTriangles | ( | ) | const |
| size_t agxOSG::PressureAtlas::getNumVertices | ( | ) | const |
| const agxCollide::Trimesh * agxOSG::PressureAtlas::getPhysicsMesh | ( | ) |
| osg::Image * agxOSG::PressureAtlas::getPressureMap | ( | ) |
Returns the pressure map.
It is a 2D image containing the pressure on the mesh mapped onto the mesh according to the texture coordinate found in the osg::Geometry returned by getGraphicsMesh(). The image format is one 32-bit floating point channel per texel, i.e., GL_RED, GL_FLOAT.
| osg::Vec2Array & agxOSG::PressureAtlas::getTextureCoordinates | ( | ) |
| size_t agxOSG::PressureAtlas::getVertexIndex | ( | size_t | triangleIndex, |
| size_t | localVertexIndex | ||
| ) | const |
| bool agxOSG::PressureAtlas::isDirty | ( | ) | const |
Check if the pressure map is dirty.
It is dirty if 'clearPressure' or 'addPressure' has been called with a non-zero magnitude since the last call to 'updateColorImages'.
| bool agxOSG::PressureAtlas::isPressurized | ( | ) | const |
Check if the pressure map is pressurized.
It is pressurized if 'addPressure' has been called with a non-zero pressure since the last call to 'clearPressure'.
| bool agxOSG::PressureAtlas::registerColorConverter | ( | agxOSG::PressureToColorConverter * | colorConverter | ) |
Make the given color converter perform color conversion on this atlas' pressure map when PressureAtlas::updateColorImages is called.
Will hold a reference to the converter.
| colorConverter | Color converter that should convert this atlas' pressure map. |
| bool agxOSG::PressureAtlas::registerPressureGenerator | ( | agxOSG::PressureGenerator * | generator | ) |
Let this PressureAtlas take over overship of the given pressure generator.
A generator can only be registered on one atlas at the time and will be rejected (false returned) if it was already registered to another atlas.
| bool agxOSG::PressureAtlas::unregisterColorConverter | ( | agxOSG::PressureToColorConverter * | colorConverter | ) |
Cause the given color converter to no longer receive update calls from PressureAtlas::updateColorImages.
Will release a reference to the color converter, so beware that the given pointer may become dangling.
| colorConverter | The color converter to unregister. |
| void agxOSG::PressureAtlas::updateColorImages | ( | ) |
Trigger a color conversion on all converters, if the pressure map is dirty.