|
AGXDynamics
2.31.1.0
|
Implementation of batch rendering of rigid body center of mass position. More...
#include <RenderProxy.h>
Inheritance diagram for agxOSG::RigidBodyBatchRenderProxy< ContainerType, TransformType >:Public Types | |
| typedef agx::Vector< const agx::RigidBody * > | Container |
| enum | EventType { ENABLE, TRANSFORM, ALPHA, COLOR, SHAPE, REMOVE, RENDERMODE } |
| Enum for specifying a type of event which might change a RenderProxy. More... | |
| enum | RenderMode { NOT_SET = 0x0, SOLID = 0x1, WIREFRAME = 0x2 } |
Public Member Functions | |
| RigidBodyBatchRenderProxy (osg::Geode *geode, const ContainerType *container, agxOSG::RenderProxyFactory *factory) | |
| 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 | callOnChange (EventType type) |
Explicitly fires event of type. More... | |
| void | clear () |
| Reset container pointer and removes all child transforms. More... | |
| bool | compare () const |
| Compare the modified count with its associated shape. More... | |
| virtual float | getAlpha () const |
| virtual agx::Vec3 | getColor () const |
| bool | getEnable () const |
| const agxCollide::Geometry * | getGeometry () const |
| agx::UInt32 | getModifiedCount () const |
| This value tells us that if the proxy is synchronized with the associated shape. More... | |
| int | getReferenceCount () const |
| RenderMode | getRenderMode () const |
| float | getScale () const |
| const agxCollide::Shape * | getShape () const |
| const agx::AffineMatrix4x4 & | getTransform () const |
| PrimitiveType | getType () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| bool | isEnabled () const |
| 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... | |
| void | set (const agx::RigidBodyPtrSetVector *enabledBodies, float scale) |
| virtual void | setAlpha (float alpha) |
| Set the alpha value of this proxy. More... | |
| virtual void | setColor (const agx::Vec3 &color) |
| Set the color of this proxy. More... | |
| void | setContainer (const ContainerType *container) |
| Assign compatible container. More... | |
| void | setEnable (bool flag) |
| Toggle this proxy for rendering on/off. More... | |
| void | setRenderMode (RenderMode mode) |
| Set the render mode for this Proxy. More... | |
| void | setScale (float scale) |
| Assign transform scale. More... | |
| virtual void | setTransform (const agx::AffineMatrix4x4 &transform) |
| Set the transform of this RenderProxy, if overridden, set the m_transform and call onUpdate(TRANSFORM) 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... | |
| void | update (bool addScaleTransform=false) |
| Updates transforms. More... | |
| virtual void | updateShape () |
| Called when a Shape has been changed (for example radius on a sphere is changed). More... | |
Static Public Member Functions | |
| static agx::Bool | shouldRender (const agx::RigidBody *rb) |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Protected Member Functions | |
| virtual | ~RigidBodyBatchRenderProxy () |
| ADD_COMMON_METHODS () | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
| agx::Vec3f | findScale (const typename ContainerType::value_type &val) const |
| Find scale (agx::Vec3) given container value type. More... | |
| template<> | |
| agx::Vec3f | findScale (const agxRender::WireRenderProxy::SegmentDefContainer::value_type &val) const |
| agx::AffineMatrix4x4 | findTransform (const typename ContainerType::value_type &val) const |
| Find transform (agx::AffineMatrix4x4) given container value type. More... | |
| template<> | |
| agx::AffineMatrix4x4 | findTransform (const agxCollide::GeometryContactPtrVector::value_type &) const |
| template<> | |
| agx::AffineMatrix4x4 | findTransform (const agx::RigidBodyPtrSetVector::value_type &rbRefPtr) const |
| template<> | |
| agx::AffineMatrix4x4 | findTransform (const agxRender::RigidBodyBatchRenderProxy::Container::value_type &rbPtr) const |
| template<> | |
| agx::AffineMatrix4x4 | findTransform (const agxData::Array< agx::Vec3 >::value_type &p) const |
| virtual void | onChange (EventType) |
| Pure virtual method that should response on the different events. More... | |
| void | prepare (size_t numObjects) |
| Prepare the root transform with the current amount of child nodes. More... | |
| void | prepareWithScale (size_t numObjects) |
| Including scale transform. More... | |
| virtual void | reset () override |
| Will reset color, alpha and enabled state back to default state (as when initially created). More... | |
| void | setModifiedCount (agx::UInt32 c) |
| void | setShape (agxCollide::Shape *shape, const agxCollide::Geometry *geometry) |
| Set the shape for this proxy. More... | |
| void | setTransform (TransformType *obj, const agx::AffineMatrix4x4 &transform, const agx::Vec3f &scale) |
| Assign transform (given agx type) to a supported osg transform. More... | |
| virtual void | synchronizeParameters () |
| This method should be implemented so that it extracts size parameters from an associated shape and store it in the Proxy parameters (radius/length etc). More... | |
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 | |
| agxRender::RigidBodyBatchRenderProxy::Container | m_bodies |
| const ContainerType * | m_container |
| osg::ref_ptr< osg::Geode > | m_geode |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
| float | m_scale |
| float | m_scale |
| agx::observer_ptr < agxCollide::Shape > | m_shape |
| agx::AffineMatrix4x4 | m_transform |
Implementation of batch rendering of rigid body center of mass position.
Definition at line 771 of file agxOSG/RenderProxy.h.
|
inherited |
Definition at line 849 of file agxRender/RenderProxy.h.
|
inherited |
Enum for specifying a type of event which might change a RenderProxy.
| Enumerator | |
|---|---|
| ENABLE |
A RenderProxy is enabled/disabled. |
| TRANSFORM |
The transformation for a proxy is updated. |
| ALPHA |
The alpha value for a proxy is updated. |
| COLOR |
The color value for a proxy is updated. |
| SHAPE |
The Shape has been modified a rebuild is needed. |
| REMOVE |
The Shape has been removed from space, need to be removed from rendering. |
| RENDERMODE |
The RenderMode has been changed. |
Definition at line 81 of file agxRender/RenderProxy.h.
|
inherited |
| Enumerator | |
|---|---|
| NOT_SET | |
| SOLID | |
| WIREFRAME | |
Definition at line 91 of file agxRender/RenderProxy.h.
|
inline |
Definition at line 774 of file agxOSG/RenderProxy.h.
|
inlineprotectedvirtual |
Reimplemented from agxRender::RigidBodyBatchRenderProxy.
Definition at line 778 of file agxOSG/RenderProxy.h.
|
inlineprotected |
Definition at line 781 of file agxOSG/RenderProxy.h.
References agxRender::RigidBodyBatchRenderProxy::m_bodies, agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >::m_container, agxRender::RigidBodyBatchRenderProxy::m_scale, agxOSG::ShapeBatchRenderer< TransformType >::setScale(), agxRender::RenderProxy::setTransform(), and agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >::update().
|
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 |
Explicitly fires event of type.
| type | - type of event to fire to this render proxy |
Referenced by agxRender::RenderProxy::setAlpha(), agxRender::RenderProxy::setColor(), agxRender::RenderProxy::setEnable(), agxRender::RenderProxy::setRenderMode(), and agxRender::RenderProxy::setTransform().
|
inherited |
Reset container pointer and removes all child transforms.
Definition at line 876 of file agxOSG/RenderProxy.h.
References agxOSG::ShapeBatchRenderer< TransformType >::clear().
Referenced by agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >::~ContainerShapeBatchRenderer().
|
inherited |
Compare the modified count with its associated shape.
|
protectedinherited |
|
protectedinherited |
Find scale (agx::Vec3) given container value type.
Default assigned scale returned.
Definition at line 938 of file agxOSG/RenderProxy.h.
|
inlineprotectedinherited |
Definition at line 944 of file agxOSG/RenderProxy.h.
References agxOSG::ShapeBatchRenderer< TransformType >::getScale().
|
protectedinherited |
Find transform (agx::AffineMatrix4x4) given container value type.
| val | - container value |
Definition at line 908 of file agxOSG/RenderProxy.h.
|
inlineprotectedinherited |
Definition at line 914 of file agxOSG/RenderProxy.h.
|
inlineprotectedinherited |
Definition at line 920 of file agxOSG/RenderProxy.h.
References agx::RigidBody::getCmTransform().
|
inlineprotectedinherited |
Definition at line 926 of file agxOSG/RenderProxy.h.
References agx::RigidBody::getCmTransform().
|
inlineprotectedinherited |
Definition at line 932 of file agxOSG/RenderProxy.h.
References agx::AffineMatrix4x4T< Real >::translate().
|
inlinevirtualinherited |
Definition at line 1001 of file agxRender/RenderProxy.h.
|
inlinevirtualinherited |
Definition at line 989 of file agxRender/RenderProxy.h.
|
staticprotectedinherited |
|
inlineinherited |
Definition at line 1036 of file agxRender/RenderProxy.h.
|
inlineinherited |
Definition at line 1024 of file agxRender/RenderProxy.h.
|
inlineinherited |
This value tells us that if the proxy is synchronized with the associated shape.
When a shape change any of its attributes, it will increment its own number. If it does not match this, it will trigger onChange(SHAPE).
Definition at line 1009 of file agxRender/RenderProxy.h.
Referenced by agxRender::HeightFieldProxy::setHeights().
|
inherited |
|
inlineinherited |
Definition at line 1047 of file agxRender/RenderProxy.h.
|
inherited |
Definition at line 870 of file agxOSG/RenderProxy.h.
Referenced by agxOSG::ContainerShapeBatchRenderer< ContainerType, TransformType >::findScale().
|
inlineinherited |
Definition at line 1020 of file agxRender/RenderProxy.h.
References agxRender::RenderProxy::m_shape.
Referenced by agxRender::HeightFieldProxy::setHeights().
|
inlineinherited |
Definition at line 978 of file agxRender/RenderProxy.h.
References agxRender::RenderProxy::m_transform.
|
inlineinherited |
Definition at line 972 of file agxRender/RenderProxy.h.
|
inherited |
Subclass test.
Referenced by agx::Object::getAutoScopedResource(), agxData::Buffer::getElement(), and agx::Object::getResource().
|
inlineinherited |
Definition at line 165 of file agxRender/RenderProxy.h.
Pure virtual method that should response on the different events.
This method is (indirectly via callOnChange) called from most set* methods. Should really never be called direct from anywhere else but from callOnChange.
Definition at line 195 of file agxRender/RenderProxy.h.
|
protectedinherited |
Prepare the root transform with the current amount of child nodes.
| numObjects | - number of child transforms |
|
protectedinherited |
Including scale transform.
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().
|
inlineoverrideprotectedvirtual |
Will reset color, alpha and enabled state back to default state (as when initially created).
Reimplemented from agxRender::RenderProxy.
Definition at line 792 of file agxOSG/RenderProxy.h.
|
inlineinherited |
Definition at line 855 of file agxRender/RenderProxy.h.
References agx::SetVector< DataT, HashT >::at(), agxRender::RenderProxy::shouldRender(), and agx::SetVector< DataT, HashT >::size().
|
inlinevirtualinherited |
Set the alpha value of this proxy.
If overridden, store color in m_alpha and call onUpdate(ALPHA)
Definition at line 993 of file agxRender/RenderProxy.h.
References agxRender::RenderProxy::ALPHA, agxRender::RenderProxy::callOnChange(), and agx::equivalent().
Set the color of this proxy.
If overridden, store color in m_color and call onUpdate(COLOR)
Definition at line 982 of file agxRender/RenderProxy.h.
References agxRender::RenderProxy::callOnChange(), agxRender::RenderProxy::COLOR, and agx::equivalent().
|
inherited |
Assign compatible container.
Definition at line 902 of file agxOSG/RenderProxy.h.
|
staticprotectedinherited |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
|
inlineinherited |
Toggle this proxy for rendering on/off.
Will trigger onUpdate(ENABLE)
Definition at line 1028 of file agxRender/RenderProxy.h.
References agxRender::RenderProxy::callOnChange(), and agxRender::RenderProxy::ENABLE.
|
inlineprotectedinherited |
Definition at line 1005 of file agxRender/RenderProxy.h.
Referenced by agxRender::HeightFieldProxy::setHeights(), and agxRender::RenderProxy::setShape().
|
inlineinherited |
Set the render mode for this Proxy.
Will trigger onUpdate(RENDERMODE)
Definition at line 1040 of file agxRender/RenderProxy.h.
References agxRender::RenderProxy::callOnChange(), and agxRender::RenderProxy::RENDERMODE.
|
inherited |
Assign transform scale.
Default: 1.
| scale | - new scale |
Definition at line 864 of file agxOSG/RenderProxy.h.
Referenced by agxOSG::RigidBodyBatchRenderProxy< ContainerType, TransformType >::ADD_COMMON_METHODS().
|
inlineprotectedinherited |
Set the shape for this proxy.
Definition at line 1013 of file agxRender/RenderProxy.h.
References agxRender::RenderProxy::m_shape, and agxRender::RenderProxy::setModifiedCount().
|
inlinevirtualinherited |
Set the transform of this RenderProxy, if overridden, set the m_transform and call onUpdate(TRANSFORM)
Reimplemented in agxOSG::TextProxy.
Definition at line 974 of file agxRender/RenderProxy.h.
References agxRender::RenderProxy::callOnChange(), agxRender::RenderProxy::m_transform, agxData::transform(), and agxRender::RenderProxy::TRANSFORM.
Referenced by agxOSG::RigidBodyBatchRenderProxy< ContainerType, TransformType >::ADD_COMMON_METHODS().
|
protectedinherited |
Assign transform (given agx type) to a supported osg transform.
| obj | - transform object to be assigned |
| transform | - transform to a assign |
| scale | - scale factor |
|
staticinherited |
Referenced by agxRender::RigidBodyBatchRenderProxy::set().
|
inlineprotectedvirtualinherited |
This method should be implemented so that it extracts size parameters from an associated shape and store it in the Proxy parameters (radius/length etc).
Reimplemented in agxRender::BoxProxy, agxRender::WireShapeProxy, agxRender::CapsuleProxy, agxRender::HollowTruncatedConeProxy, agxRender::TruncatedConeProxy, agxRender::ConeProxy, agxRender::HollowCylinderProxy, agxRender::CylinderProxy, agxRender::LineProxy, agxRender::SphereProxy, and agxRender::PlaneProxy.
Definition at line 188 of file agxRender/RenderProxy.h.
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.
|
inherited |
Updates transforms.
Definition at line 883 of file agxOSG/RenderProxy.h.
References agxAssert, and agxData::transform().
Referenced by agxOSG::RigidBodyBatchRenderProxy< ContainerType, TransformType >::ADD_COMMON_METHODS().
|
inlinevirtualinherited |
Called when a Shape has been changed (for example radius on a sphere is changed).
Definition at line 128 of file agxRender/RenderProxy.h.
|
staticinherited |
|
protectedinherited |
Definition at line 874 of file agxRender/RenderProxy.h.
Referenced by agxOSG::RigidBodyBatchRenderProxy< ContainerType, TransformType >::ADD_COMMON_METHODS().
|
protectedinherited |
Definition at line 740 of file agxOSG/RenderProxy.h.
Referenced by agxOSG::RigidBodyBatchRenderProxy< ContainerType, TransformType >::ADD_COMMON_METHODS().
|
protectedinherited |
Definition at line 676 of file agxOSG/RenderProxy.h.
|
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.
|
protectedinherited |
Definition at line 677 of file agxOSG/RenderProxy.h.
|
protectedinherited |
Definition at line 875 of file agxRender/RenderProxy.h.
Referenced by agxOSG::RigidBodyBatchRenderProxy< ContainerType, TransformType >::ADD_COMMON_METHODS().
|
protectedinherited |
Definition at line 205 of file agxRender/RenderProxy.h.
Referenced by agxRender::RenderProxy::getShape(), and agxRender::RenderProxy::setShape().
|
protectedinherited |
Definition at line 206 of file agxRender/RenderProxy.h.
Referenced by agxRender::RenderProxy::getTransform(), and agxRender::RenderProxy::setTransform().