|
AGXDynamics
2.31.1.0
|
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'. More... | |
| template<typename T > | |
| T * | as () |
| Subclass casting. More... | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. More... | |
| template<typename T > | |
| const T * | asSafe () const |
| void | clearPressure () |
| Fill the pressure map with zeros. More... | |
| agxOSG::GeometryNode * | createAtlasRendering () |
| osg::Geometry * | getGraphicsMesh () |
| Returns an OSG Geometry that can be used to render the collected pressure. More... | |
| size_t | getNumTriangles () const |
| size_t | getNumVertices () const |
| const agxCollide::Trimesh * | getPhysicsMesh () |
| osg::Image * | getPressureMap () |
| Returns the pressure map. More... | |
| int | getReferenceCount () const |
| osg::Vec2Array & | getTextureCoordinates () |
| size_t | getVertexIndex (size_t triangleIndex, size_t localVertexIndex) const |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| bool | isDirty () const |
| Check if the pressure map is dirty. More... | |
| bool | isPressurized () const |
| Check if the pressure map is pressurized. More... | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More... | |
| bool | registerColorConverter (agxOSG::PressureToColorConverter *colorConverter) |
| Make the given color converter perform color conversion on this atlas' pressure map when PressureAtlas::updateColorImages is called. More... | |
| bool | registerPressureGenerator (agxOSG::PressureGenerator *generator) |
| Let this PressureAtlas take over overship of the given pressure generator. More... | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
| bool | unregisterColorConverter (agxOSG::PressureToColorConverter *colorConverter) |
| Cause the given color converter to no longer receive update calls from PressureAtlas::updateColorImages. More... | |
| void | updateColorImages () |
| Trigger a color conversion on all converters, if the pressure map is dirty. More... | |
Static Public Member Functions | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Protected Member Functions | |
| virtual | ~PressureAtlas () |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Static Protected Member Functions | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More... | |
Protected Attributes | |
| 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. |
|
protectedinherited |
|
inherited |
Subclass casting.
Template type must match actual type, dynamic_cast assertion will fail otherwise.
Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), and agx::InternalData::getOrCreate().
|
inherited |
|
inherited |
Safe subclass casting, return nullptr if template type does not match.
Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().
|
inherited |
| void agxOSG::PressureAtlas::clearPressure | ( | ) |
Fill the pressure map with zeros.
Set the dirty flag and clear the pressurized flag.
| agxOSG::GeometryNode* agxOSG::PressureAtlas::createAtlasRendering | ( | ) |
|
protectedinherited |
|
staticprotectedinherited |
| 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.
|
inherited |
| osg::Vec2Array& agxOSG::PressureAtlas::getTextureCoordinates | ( | ) |
| size_t agxOSG::PressureAtlas::getVertexIndex | ( | size_t | triangleIndex, |
| size_t | localVertexIndex | ||
| ) | const |
|
inherited |
Subclass test.
Referenced by agx::Object::getAutoScopedResource(), agxData::Buffer::getElement(), and agx::Object::getResource().
| 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'.
Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
This method should be used with care, always balanced with the same number of calls to unreference.
Referenced by agxData::Val< UInt >::Val().
| 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.
|
staticprotectedinherited |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.
This method should be used with care, always balanced with the same number of calls to reference.
|
inherited |
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.
| 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.
|
staticinherited |
|
mutableprotectedinherited |
Definition at line 240 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 239 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 241 of file Referenced.h.