17 #ifndef AGXRENDER_RENDERPROXY_H
18 #define AGXRENDER_RENDERPROXY_H
109 virtual void setColor(
const agx::Vec3& color );
120 virtual void setAlpha(
float alpha );
123 virtual float getAlpha()
const;
159 void setEnable(
bool flag );
162 bool getEnable()
const;
171 void setRenderMode( RenderMode mode );
174 RenderMode getRenderMode( )
const;
228 m_transform.setTranslate( pos[0], pos[1], pos[2] );
229 callOnChange( SHAPE );
235 return m_transform.getTranslate();
253 m_distance = distance;
254 callOnChange( SHAPE );
284 void set(
float radius ) {
286 callOnChange( SHAPE );
315 callOnChange( SHAPE );
345 void set(
float radius,
float height ) {
348 callOnChange( SHAPE );
384 void set(
float radius,
float height,
float thickness ) {
387 m_thickness = thickness;
388 callOnChange( SHAPE );
431 void set(
float radius,
float height ) {
434 callOnChange( SHAPE );
470 void set(
float topRadius,
float bottomRadius,
float height ) {
471 m_topRadius = topRadius;
472 m_bottomRadius = bottomRadius;
474 callOnChange( SHAPE );
486 return m_bottomRadius;
516 void set(
float topRadius,
float bottomRadius,
float height,
float thickness ) {
517 m_topRadius = topRadius;
518 m_bottomRadius = bottomRadius;
520 m_thickness = thickness;
521 callOnChange( SHAPE );
533 return m_bottomRadius;
570 void set(
float radius,
float height ) {
573 callOnChange( SHAPE );
611 const agx::Vec3& previousEndPoint0,
const agx::Vec3& previousEndPoint1,
float radius );
613 void set(
float radius,
float height) {
616 callOnChange( SHAPE );
619 void set(
float radius,
float height,
624 m_previousEndPoint0 = previousEndPoint0;
625 m_previousEndPoint1 = previousEndPoint1;
626 callOnChange( SHAPE );
630 const agx::Vec3& previousEndPoint0,
const agx::Vec3& previousEndPoint1,
float radius );
646 return m_previousEndPoint0;
653 return m_previousEndPoint1;
682 m_halfExtents = halfExtents;
683 callOnChange( SHAPE );
687 return m_halfExtents;
774 m_positions = positions;
777 callOnChange( SHAPE );
782 virtual ~SphereSpriteBatchRenderProxy() {}
805 callOnChange( SHAPE );
809 virtual ~SphereMeshBatchRenderProxy() {}
828 m_contacts = &contacts;
830 callOnChange( SHAPE );
858 if ( enabledBodies !=
nullptr ) {
859 m_bodies.reserve( enabledBodies->
size() );
863 m_bodies.push_back( rb );
867 callOnChange( SHAPE );
884 : startPoint( sp ), endPoint( ep ), radius( r ) {}
1006 m_modifiedCount = c;
1010 return m_modifiedCount;
1015 m_geometry = geometry;
1029 if (m_enable != flag)
1041 if ( mode != m_renderMode ) {
1055 set( modifiedIndices, heights );
1068 return agx::Vec3f( radius, radius, (
float)startPoint.distance( endPoint ) );
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXPHYSICS_EXPORT
A box shape for geometric intersection tests.
Implements a Capsule shape for geometric intersection tests.
A right circular cone shape for geometric intersection tests.
A cylinder shape for geometric intersection tests.
The geometry representation used by the collision detection engine.
A HeightField is a collision shape that can be created from a grid structure, like an image.
A right circular hollow cone shape for geometric intersection tests.
A hollow cylinder shape for geometric intersection tests.
A line shape for intersection tests, mostly for depth sensing and picking.
A sphere class for geometric intersection tests.
Triangle mesh for geometric intersection tests.
Internal class used by agxWire::Wire.
Type-specific Array used for fast access into the data held by a Buffer.
Abstract representation of a data buffer.
Abstract representation of a value.
Subclass that implements a BoxProxy.
const agxCollide::Box * getCastShape() const
BoxProxy(const agx::Vec3 &halfExtents)
void synchronizeParameters()
This method should be implemented so that it extracts size parameters from an associated shape and st...
void set(const agx::Vec3 &halfExtents)
Set the size of the box, will trigger onChange(SHAPE)
agx::Vec3 getHalfExtents() const
Subclass that implements a CapsuleProxy.
CapsuleProxy(float radius, float height)
const agxCollide::Capsule * getCastShape() const
CapsuleProxy(const agx::Vec3 &begin, const agx::Vec3 &end, float radius)
void set(float radius, float height)
void synchronizeParameters()
This method should be implemented so that it extracts size parameters from an associated shape and st...
void set(const agx::Vec3 &begin, const agx::Vec3 &end, float radius)
Subclass that implements a ConeProxy.
void synchronizeParameters()
This method should be implemented so that it extracts size parameters from an associated shape and st...
void set(const agx::Vec3 &begin, const agx::Vec3 &end, float radius)
void set(float radius, float height)
ConeProxy(const agx::Vec3 &begin, const agx::Vec3 &end, float radius)
ConeProxy(float radius, float height)
const agxCollide::Cone * getCastShape() const
Subclass that implements a CylinderProxy.
CylinderProxy(const agx::Vec3 &begin, const agx::Vec3 &end, float radius)
void set(const agx::Vec3 &begin, const agx::Vec3 &end, float radius)
void set(float radius, float height)
void synchronizeParameters()
This method should be implemented so that it extracts size parameters from an associated shape and st...
CylinderProxy(float radius, float height)
const agxCollide::Cylinder * getCastShape() const
Subclass that implements a HeightfieldProxy.
void setHeights(const agx::Vec2iVector &modifiedIndices, const agx::RealVector &heights)
Set specified heights of a Heightfield.
HeightFieldProxy & operator=(const HeightFieldProxy &)
virtual void set(const agx::Vec2iVector &modifiedIndices, const agx::RealVector &heights)=0
Override this method to support changing a selection of indices in the heightfield.
HeightFieldProxy(agxCollide::HeightField *hf)
const agxCollide::HeightField * getCastShape() const
virtual ~HeightFieldProxy()
Destructor.
Subclass that implements a CylinderProxy.
void set(float radius, float height, float thickness)
HollowCylinderProxy(const agx::Vec3 &begin, const agx::Vec3 &end, float radius, float thickness)
HollowCylinderProxy(float radius, float height, float thickness)
float getThickness() const
void set(const agx::Vec3 &begin, const agx::Vec3 &end, float radius, float thickness)
virtual ~HollowCylinderProxy()
const agxCollide::HollowCylinder * getCastShape() const
void synchronizeParameters()
This method should be implemented so that it extracts size parameters from an associated shape and st...
Subclass that implements a HollowTruncatedConeProxy.
HollowTruncatedConeProxy(float topRadius, float bottomRadius, float height, float thickness)
virtual ~HollowTruncatedConeProxy()
void set(const agx::Vec3 &top, const agx::Vec3 &bottom, float topRadius, float bottomRadius, float thickness)
void synchronizeParameters()
This method should be implemented so that it extracts size parameters from an associated shape and st...
void set(float topRadius, float bottomRadius, float height, float thickness)
float getThickness() const
float getTopRadius() const
HollowTruncatedConeProxy(const agx::Vec3 &begin, const agx::Vec3 &end, float topRadius, float bottomRadius, float thickness)
const agxCollide::HollowCone * getCastShape() const
float getBottomRadius() const
HollowTruncatedConeProxy()
Subclass that implements a LineProxy.
const agxCollide::Line * getCastShape() const
LineProxy(const agx::Vec3 &p1, const agx::Vec3 &p2)
void synchronizeParameters()
This method should be implemented so that it extracts size parameters from an associated shape and st...
void set(const agx::Vec3 &p1, const agx::Vec3 &p2)
Subclass that implements a PlaneProxy.
const agxCollide::Plane * getCastShape() const
agx::Real getDistance() const
void set(const agx::Vec3 &normal, agx::Real distance)
PlaneProxy(const agx::Vec3 &normal, agx::Real distance)
agx::Vec3 getNormal() const
void synchronizeParameters()
This method should be implemented so that it extracts size parameters from an associated shape and st...
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
Abstract base class which encapsulated information for rendering a specific shape.
virtual float getAlpha() const
virtual void setAlpha(float alpha)
Set the alpha value of this proxy.
const agxCollide::Geometry * getGeometry() const
virtual agx::Vec3 getColor() const
void setModifiedCount(agx::UInt32 c)
agx::UInt32 getModifiedCount() const
This value tells us that if the proxy is synchronized with the associated shape.
virtual ~RenderProxy()
Destructor.
void setEnable(bool flag)
Toggle this proxy for rendering on/off.
virtual void onChange(EventType)
Pure virtual method that should response on the different events.
RenderMode getRenderMode() const
agx::AffineMatrix4x4 m_transform
virtual void updateShape()
Called when a Shape has been changed (for example radius on a sphere is changed).
virtual void synchronizeParameters()
This method should be implemented so that it extracts size parameters from an associated shape and st...
void setShape(agxCollide::Shape *shape, const agxCollide::Geometry *geometry)
Set the shape for this proxy.
void callOnChange(EventType type)
Explicitly fires event of type.
virtual void reset()
Will reset color, alpha and enabled state back to default state (as when initially created).
virtual void setTransform(const agx::AffineMatrix4x4 &transform)
Set the transform of this RenderProxy, if overridden, set the m_transform and call onUpdate(TRANSFORM...
virtual void setColor(const agx::Vec3 &color)
Set the color of this proxy.
const agx::AffineMatrix4x4 & getTransform() const
PrimitiveType getType() const
const agxCollide::Shape * getShape() const
bool compare() const
Compare the modified count with its associated shape.
static agx::Bool shouldRender(const agx::RigidBody *rb)
EventType
Enum for specifying a type of event which might change a RenderProxy.
@ COLOR
The color value for a proxy is updated.
@ ENABLE
A RenderProxy is enabled/disabled.
@ REMOVE
The Shape has been removed from space, need to be removed from rendering.
@ RENDERMODE
The RenderMode has been changed.
@ ALPHA
The alpha value for a proxy is updated.
@ TRANSFORM
The transformation for a proxy is updated.
@ SHAPE
The Shape has been modified a rebuild is needed.
agx::observer_ptr< agxCollide::Shape > m_shape
RenderProxy(PrimitiveType type, agxCollide::Shape *shape=nullptr)
Constructor.
void setRenderMode(RenderMode mode)
Set the render mode for this Proxy.
Class holding rigid bodies that makes it possible to batch render these objects.
virtual ~RigidBodyBatchRenderProxy()
agx::Vector< const agx::RigidBody * > Container
void set(const agx::RigidBodyPtrSetVector *enabledBodies, float scale)
agxRender::RigidBodyBatchRenderProxy::Container m_bodies
RigidBodyBatchRenderProxy()
Subclass that implements a SphereProxy.
void synchronizeParameters()
This method should be implemented so that it extracts size parameters from an associated shape and st...
const agxCollide::Sphere * getCastShape() const
SphereProxy(float radius)
Subclass that implements a TextProxy.
TextProxy(const agx::String &text, const agx::Vec3 &pos)
void set(const agx::String &text, const agx::Vec3 &pos)
agx::Vec3 getPosition() const
agx::String getText() const
Subclass that implements a TrimeshProxy.
void set(agxCollide::Trimesh *mesh)
const agxCollide::Trimesh * getCastShape() const
TrimeshProxy(agxCollide::Trimesh *mesh)
TrimeshProxy & operator=(const TrimeshProxy &)
Subclass that implements a TruncatedConeProxy.
TruncatedConeProxy(const agx::Vec3 &begin, const agx::Vec3 &end, float topRadius, float bottomRadius)
TruncatedConeProxy(float topRadius, float bottomRadius, float height)
virtual ~TruncatedConeProxy()
const agxCollide::Cone * getCastShape() const
float getBottomRadius() const
void set(const agx::Vec3 &top, const agx::Vec3 &bottom, float topRadius, float bottomRadius)
float getTopRadius() const
void set(float topRadius, float bottomRadius, float height)
void synchronizeParameters()
This method should be implemented so that it extracts size parameters from an associated shape and st...
void addNode(const agx::Vec3 &point)
Node with default color (lumped node).
SegmentDefContainer m_segments
virtual void onAddNotification()
Called when the wire is added to the simulation.
agx::VectorPOD< SphereDef > SphereDefContainer
agx::VectorPOD< SegmentDef > SegmentDefContainer
void commit()
Commit the current state to the renderer.
void addSegment(const agx::Vec3 &startPoint, const agx::Vec3 &endPoint, const agx::Vec3 &prevStartPoint, const agx::Vec3 &prevEndPoint)
Add segment with global radius and color.
virtual ~WireRenderProxy()
void addSegment(const agx::Vec3 &startPoint, const agx::Vec3 &endPoint, float radius, const agx::Vec3 &color, agxRender::RenderManager *manager) const
Slow, non-batch-rendered, segment.
void addNode(const agx::Vec3 &point, float radius, const agx::Vec3 &color, agxRender::RenderManager *manager) const
Node with different color and/or size.
void prepare(agx::UInt numSegmentEstimate, agx::UInt numEdgesEstimate, agx::UInt numNodesEstimate)
Prepare buffers.
void addEdge(const agx::Vec3 &startPoint, const agx::Vec3 &endPoint)
Edges are always red and same radius as others.
virtual void onRemoveNotification()
Called when the wire is removed from the simulation.
SphereDefContainer m_nodes
WireRenderProxy(float radius, const agx::Vec3 &color)
SegmentDefContainer m_edges
Subclass that implements a WireShapeProxy.
void set(float radius, float height, const agx::Vec3 &previousEndPoint0, const agx::Vec3 &previousEndPoint1)
void set(float radius, float height)
void set(const agx::Vec3 &begin, const agx::Vec3 &end, const agx::Vec3 &previousEndPoint0, const agx::Vec3 &previousEndPoint1, float radius)
agx::Vec3 getPreviousEndPoint1() const
agx::Vec3 getPreviousEndPoint0() const
const agxCollide::WireShape * getCastShape() const
agx::Vec3 m_previousEndPoint1
void synchronizeParameters()
This method should be implemented so that it extracts size parameters from an associated shape and st...
WireShapeProxy(const agx::Vec3 &begin, const agx::Vec3 &end, const agx::Vec3 &previousEndPoint0, const agx::Vec3 &previousEndPoint1, float radius)
agx::Vec3 m_previousEndPoint0
WireShapeProxy(float radius, float height, const agx::Vec3 &previousEndPoint0, const agx::Vec3 &previousEndPoint1)
virtual ~WireShapeProxy()
static AffineMatrix4x4T< Real > rotate(const Vec3T< Real > &from, const Vec3T< Real > &to)
Return a matrix which rotate a vector from from to to.
static AffineMatrix4x4T< Real > translate(const Vec3T< Real > &dv)
Return a matrix which translates according to dv.
Base class providing referencing counted objects.
The rigid body class, combining a geometric model and a frame of reference.
size_t size() const
Return the number of inserted elements.
const DataT & at(size_t index) const
Access an element in the vector using an index.
Vector containing 'raw' data.
Smart pointer for handling referenced counted objects.
This namespace consists of a set of classes for handling geometric intersection tests including boole...
AGXCORE_EXPORT Type * getType(const agx::String &name)
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
AGXOSG_EXPORT void setAlpha(osg::Node *node, float alpha)
Set the alpha part of the material for a node.
Namespace containing classes for handling debug rendering of collision geometries,...
@ PRIMITIVE_HOLLOW_TRUNCATED_CONE
@ PRIMITIVE_HOLLOW_CYLINDER
@ PRIMITIVE_TRUNCATED_CONE
agx::ref_ptr< WireRenderProxy > WireRenderProxyRef
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
PlaneT< agx::Real > Plane
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
AGXPHYSICS_EXPORT agx::Bool equivalent(const agx::AddedMassInteraction::Matrix6x6 &lhs, const agx::AddedMassInteraction::Matrix6x6 &rhs, agx::Real eps=agx::RealEpsilon)
const SegmentDef * operator->() const
agx::Vec3f getScale() const
agx::AffineMatrix4x4 getTransform() const
SegmentDef(const agx::Vec3 &sp, const agx::Vec3 &ep, float r)
SphereDef(const agx::Vec3 &p)
const SphereDef * operator->() const
agx::AffineMatrix4x4 getTransform() const