AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
agxOSG/RenderProxy.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agxOSG/export.h>
23
24#include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
25#include <osg/ref_ptr>
26#include <osg/Group>
27#include <osg/MatrixTransform>
28#include <osg/Material>
29#include <osg/AutoTransform>
30#include <osg/Shape>
31#include <osg/ShapeDrawable>
32#include <osgText/Text>
33#include <agx/PopDisableWarnings.h> // End of disabled warnings.
34
37#include <agxOSG/RenderText.h>
38#include <agxOSG/utils.h>
40
41#ifdef _MSC_VER
42# pragma warning(push)
43# pragma warning( disable : 4355 ) // warning C4355: 'this' : used in base member initializer list
44#endif
45
46namespace osg
47{
48 class Material;
49 class ShapeDrawable;
50}
51
52namespace osgText
53{
54 class Text;
55}
56
57namespace agxOSG
58{
59
61 template<typename T>
62 class OSGData
63 {
64 public:
66 : m_data(data), m_factory(factory), m_proxy(proxy)
67 {
68 m_transformNode = new osg::MatrixTransform;
69
70 m_transformNode->addChild( m_data.geode );
71
72 // Tell osg not to remove this transformation under optimization pass
73 m_transformNode->setDataVariance( osg::Object::DYNAMIC );
74
75 m_data.stateSet = m_transformNode->getOrCreateStateSet();
76
77 m_data.material = new osg::Material;
78 m_data.stateSet->setAttributeAndModes(m_data.material,osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE | osg::StateAttribute::PROTECTED);
79 setColorOSG( agx::Vec3( 1, 0, 0 ), 1.f );
80 }
81
83 : m_data(), m_factory( factory ), m_proxy( proxy )
84 {
85 m_transformNode = new osg::MatrixTransform();
86 m_transformNode->setDataVariance( osg::Object::DYNAMIC );
87
88 m_data.stateSet = m_transformNode->getOrCreateStateSet();
89 m_data.material = new osg::Material;
90 m_data.stateSet->setAttributeAndModes( m_data.material, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE | osg::StateAttribute::PROTECTED );
91 setColorOSG( agx::Vec3( 1, 0, 0 ), 1.f );
92 }
93
96 {
99 m_transformNode->setMatrix( AGX_MAT4X4_TO_OSG( m ) );
100 }
101
103 void setEnableOSG( bool flag )
104 {
105 if (!flag) { // Remove node from all its parents
106 while(m_transformNode->getNumParents())
107 {
108 m_transformNode->getParent(0)->removeChild( m_transformNode.get() );
109 }
110
111 }
112 else //Add it for rendering again.
114 }
115
117 void setAlphaOSG( float transparency )
118 {
119 m_data.material->setTransparency(osg::Material::FRONT_AND_BACK, 1-transparency);
120 }
121
123 void setColorOSG(const agx::Vec3& color, float alpha)
124 {
125 auto textShape = dynamic_cast<osgText::Text*>(m_data.shape.get());
126 if (textShape)
127 {
128 textShape->setColor(osg::Vec4((float)color[0], (float)color[1], (float)color[2], alpha));
129 return;
130 }
131
132 osg::Vec4 col = m_data.material->getDiffuse(osg::Material::FRONT_AND_BACK);
133
134 if ( agx::equivalent( (float)col[0], (float)color[0] ) &&
135 agx::equivalent( (float)col[1], (float)color[1] ) &&
136 agx::equivalent( (float)col[2], (float)color[2] ) )
137 return;
138
139 osg::Vec4 osgCol( (float)color[0], (float)color[1], (float)color[2], alpha );
140 m_data.material->setDiffuse(osg::Material::FRONT_AND_BACK, osgCol);
141
142 for ( unsigned int i = 0; m_data.geode != nullptr && i < m_data.geode->getNumDrawables(); ++i ) {
143 osg::ShapeDrawable* drawable = dynamic_cast< osg::ShapeDrawable* >( m_data.geode->getDrawable( i ) );
144 if ( drawable )
145 drawable->setColor( osgCol );
146 }
147 }
148
151 {
152 osg::ref_ptr<osg::MatrixTransform> r = m_transformNode;
153 while(m_transformNode->getNumParents())
154 {
155 m_transformNode->getParent(0)->removeChild( m_transformNode.get() );
156 }
157 }
158
161 {
163 }
164
166 osg::MatrixTransform* getNode() { return m_transformNode.get(); }
167
168 protected:
169 osg::ref_ptr<osg::MatrixTransform> m_transformNode;
174 };
175
176#ifndef SWIG
177
179#define ADD_COMMON_PROXY_METHODS() \
180 void onChange( RenderProxy::EventType type ) override { \
181 switch( type ) { \
182 case (RenderProxy::ENABLE): \
183 this->setEnableOSG(this->getEnable()); \
184 break; \
185 case (RenderProxy::ALPHA): \
186 this->setAlphaOSG(this->getAlpha()); \
187 break; \
188 case (RenderProxy::TRANSFORM): \
189 this->setTransformOSG(this->getTransform()); \
190 break; \
191 case (RenderProxy::COLOR): \
192 this->setColorOSG(this->getColor(), this->getAlpha()); \
193 break; \
194 case (RenderProxy::SHAPE): \
195 break; \
196 case (RenderProxy::REMOVE): \
197 this->onRemoveOSG(); \
198 break; \
199 case (RenderProxy::RENDERMODE): \
200 this->setRenderModeOSG(this->getRenderMode()); \
201 break; \
202 } \
203 } \
204 virtual bool updateShape() override
205#endif
206
207
209 class AGXOSG_EXPORT SphereProxy : public agxRender::SphereProxy, public OSGData<osg::Sphere>
210 {
211 public:
213
214 protected:
215 virtual ~SphereProxy() {}
216
218 };
219
221 class AGXOSG_EXPORT TextProxy : public agxRender::TextProxy, public OSGData<osgText::Text>
222 {
223 public:
225
226 //void setTransform(const agx::AffineMatrix4x4& transform) override;
227 //virtual void setColor(const agx::Vec3& color) override;
228 //virtual void setAlpha(float alpha) override;
229
230
231 protected:
232 virtual ~TextProxy() {}
233
235 };
236
237
239 class AGXOSG_EXPORT BoxProxy : public agxRender::BoxProxy, public OSGData<osg::Box>
240 {
241 public:
243
244 protected:
245 virtual ~BoxProxy() {}
246
248 };
249
251 class AGXOSG_EXPORT LineProxy : public agxRender::LineProxy, public OSGData<osg::Geometry>
252 {
253 public:
255 const agx::Vec3& p1, const agx::Vec3& p2,
257 RenderProxyFactory* factory);
258
259 protected:
260 virtual ~LineProxy() {}
261
263 };
264
266 class AGXOSG_EXPORT CylinderProxy : public agxRender::CylinderProxy, public OSGData<osg::Cylinder>
267 {
268 public:
270 float radius, float height,
272 RenderProxyFactory* factory);
273
274 protected:
275 virtual ~CylinderProxy() {}
276
278 };
279
282 {
283 public:
285 float outerRadius, float height,
286 float thickness,
288 RenderProxyFactory* factory);
289
290 protected:
292
294 };
295
297 class AGXOSG_EXPORT ConeProxy : public agxRender::ConeProxy, public OSGData<osg::Cone>
298 {
299 public:
301 float radius,
302 float height,
304 RenderProxyFactory* factory);
305
306 protected:
307 virtual ~ConeProxy() {}
308
310 };
311
314 {
315 public:
317 float topRadius,
318 float bottomRadius,
319 float height,
321 RenderProxyFactory* factory);
322
323 protected:
325
327 };
328
331 {
332 public:
334 float topRadius, float bottomRadius,
335 float height, float thickness,
337 RenderProxyFactory* factory);
338
339 protected:
340 virtual ~HollowConeProxy() {}
341
343 };
344
346 class AGXOSG_EXPORT PlaneProxy : public agxRender::PlaneProxy, public OSGData<osg::Geometry>
347 {
348 public:
350 const agx::Vec3& normal,
351 agx::Real distance,
353 RenderProxyFactory* factory);
354
355 protected:
356 virtual ~PlaneProxy() {}
357
359 };
360
362 class AGXOSG_EXPORT CapsuleProxy : public agxRender::CapsuleProxy, public OSGData<osg::Capsule>
363 {
364 public:
366 float radius,
367 float height,
369 RenderProxyFactory* factory);
370
371 protected:
372 virtual ~CapsuleProxy() {}
373
375 };
376
377
379 class AGXOSG_EXPORT WireShapeProxy : public agxRender::WireShapeProxy, public OSGData<osg::CompositeShape>
380 {
381 public:
382 WireShapeProxy( float radius, float height, const agx::Vec3& previousEndPoint0, const agx::Vec3& previousEndPoint1,
384
385 protected:
386 virtual ~WireShapeProxy() {}
387
389 };
390
393 {
394 public:
398 RenderProxyFactory* factory
399 );
400
401 void set( const agx::Vec2iVector& modifiedIndices, const agx::RealVector& heights ) override;
402
403 protected:
404 virtual ~HeightFieldProxy() {}
405
407 };
408
410 class AGXOSG_EXPORT TrimeshProxy : public agxRender::TrimeshProxy, public OSGData<osg::TriangleMesh>
411 {
412 public:
416 RenderProxyFactory* factory
417 );
418
419 protected:
420 virtual ~TrimeshProxy() {}
421
423 };
424
429 template< typename TransformType >
430 class ShapeBatchRenderer : public OSGData< osg::Group >
431 {
432 public:
436 void clear();
437
442 void setScale( float scale );
443
447 float getScale() const;
448
449 protected:
457
465
469 virtual ~ShapeBatchRenderer() { clear(); }
470
475 void prepare( size_t numObjects );
476
480 void prepareWithScale( size_t numObjects );
481
488 void setTransform( TransformType* obj, const agx::AffineMatrix4x4& transform, const agx::Vec3f& scale );
489
490 protected:
491 osg::ref_ptr< osg::Geode > m_geode;
492 float m_scale;
493 };
494
506 template< typename ContainerType, typename TransformType >
507 class ContainerShapeBatchRenderer : public ShapeBatchRenderer< TransformType >
508 {
509 public:
517 ContainerShapeBatchRenderer( osg::Geode* geode, const ContainerType* container, agxOSG::RenderProxyFactory* factory, agxRender::RenderProxy* proxy )
518 : ShapeBatchRenderer< TransformType >( geode, factory, proxy ), m_container( container ) {}
519
523 virtual ~ContainerShapeBatchRenderer() { this->clear(); }
524
528 void clear();
529
533 void update( bool addScaleTransform = false );
534
538 void setContainer( const ContainerType* container );
539
540 protected:
546 agx::AffineMatrix4x4 findTransform( const typename ContainerType::value_type& val ) const;
547
552 agx::Vec3f findScale( const typename ContainerType::value_type& val ) const;
553
554 protected:
555 const ContainerType* m_container;
556 };
557
558 #if 0
559 class SphereSpriteBatchRenderer : public ContainerShapeBatchRenderer< agxData::Array< agx::Vec3 >, osg::MatrixTransform >, public agxRender::SphereSpriteBatchRenderProxy
560 {
561 public:
562 SphereSpriteBatchRenderer( osg::Geode* geode, const agxData::Array< agx::Vec3 >* container, agxOSG::RenderProxyFactory* factory )
563 : ContainerShapeBatchRenderer< agxData::Array< agx::Vec3 >, osg::MatrixTransform >( geode, container, factory, this ),
564 agxRender::SphereSpriteBatchRenderProxy( container ) {}
565
566 protected:
567 virtual ~SphereSpriteBatchRenderer() {}
568
570 {
571 this->m_container = m_buffer;
572 this->update();
573 }
574
575 virtual void reset() override
576 {
577 // I don't think we can or could do anything during reset.
578 }
579 };
580 #endif
581
585 template< typename ContainerType, typename TransformType >
587 {
588 public:
589 RigidBodyBatchRenderProxy( osg::Geode* geode, const ContainerType* container, agxOSG::RenderProxyFactory* factory )
590 : ContainerShapeBatchRenderer< ContainerType, TransformType >( geode, container, factory, this ) {}
591
592 protected:
594
595 // This is virtual void updateShape().
597 {
598 this->m_container = &m_bodies;
600
601 // Will update root transform given a global transform.
603
604 this->update();
605 return true;
606 }
607
608 virtual void reset() override
609 {
610 // I don't think we can or could do anything during reset.
611 }
612 };
613
617 class ContactProxy : public ContainerShapeBatchRenderer< agxCollide::GeometryContactPtrVector, osg::AutoTransform >, public agxRender::ContactsProxy
618 {
619 public:
620 ContactProxy( osg::Geode* geode, const agxCollide::GeometryContactPtrVector* contacts, agxOSG::RenderProxyFactory* factory );
621
622 protected:
623 virtual ~ContactProxy() {}
624
626
627 virtual void reset() override
628 {
629 // I don't think we can or could do anything during reset.
630 }
631 };
632
634 {
635 public:
636 WireRenderProxy( float radius, const agx::Vec3& color, osg::Geode* segmentGeode, osg::Geode* edgeGeode, osg::Geode* nodeGeode, agxOSG::RenderProxyFactory* factory );
637
638 osg::MatrixTransform* getSegmentTransform();
639 osg::MatrixTransform* getEdgeTransform();
640 osg::MatrixTransform* getSphereTransform();
641
642 protected:
644
645 virtual void onAddNotification() override;
646 virtual void onRemoveNotification() override;
647
648 void setTransformOSG( const agx::AffineMatrix4x4& transform );
649 void setEnableOSG( bool flag );
650 void setAlphaOSG( float transparency );
651 void setColorOSG(const agx::Vec3& color, float alpha);
654
656
657 virtual void reset() override
658 {
659 // I don't think we can or could do anything during reset.
660 }
661
662 protected:
666
667 private:
668 // Not defined to call this method on this object.
669 osg::MatrixTransform* getNode() { return nullptr; }
670 };
671
672 template< typename TransformType >
674 {
675 if ( m_transformNode )
676 m_transformNode->removeChild( 0, m_transformNode->getNumChildren() );
677 }
678
679 template< typename TransformType >
681 {
682 m_scale = scale;
683 }
684
685 template< typename TransformType >
687 {
688 return m_scale;
689 }
690
691 template< typename ContainerType, typename TransformType >
693 {
695 m_container = nullptr;
696 }
697
698 template< typename ContainerType, typename TransformType >
700 {
701 if ( this->m_container == nullptr )
702 return;
703
704 if ( addScaleTransform )
705 this->prepareWithScale( this->m_container->size() );
706 else
707 this->prepare( this->m_container->size() );
708
709 unsigned int counter = 0;
710 for ( typename ContainerType::const_iterator i = m_container->begin(); i != m_container->end(); ++counter, ++i ) {
711 agxAssert( counter < this->m_transformNode->getNumChildren() );
712 TransformType* transform = static_cast< TransformType* >( this->m_transformNode->getChild( counter ) );
713 this->setTransform( transform, this->findTransform( *i ), this->findScale( *i ) );
714 }
715 }
716
717 template< typename ContainerType, typename TransformType >
719 {
720 m_container = container;
721 }
722
723 template< typename ContainerType, typename TransformType >
725 {
726 return val->getTransform();
727 }
728
729 template<>
731 {
732 return agx::AffineMatrix4x4();
733 }
734
735 template<>
737 {
738 return rbRefPtr->getCmTransform();
739 }
740
741 template<>
743 {
744 return rbPtr->getCmTransform();
745 }
746
747 template<>
749 {
751 }
752
753 template< typename ContainerType, typename TransformType >
754 agx::Vec3f ContainerShapeBatchRenderer< ContainerType, TransformType >::findScale( const typename ContainerType::value_type& /*val*/ ) const
755 {
757 }
758
759 template<>
761 {
762 return val->getScale();
763 }
764}
765
766#ifdef _MSC_VER
767# pragma warning(pop)
768#endif
769
#define ADD_COMMON_PROXY_METHODS()
Macro for adding some methods for each specialization of RenderProxy.
#define AGX_MAT4X4_TO_OSG(X)
#define AGXOSG_EXPORT
A HeightField is a collision shape that can be created from a grid structure, like an image.
Triangle mesh for geometric intersection tests.
Definition: Trimesh.h:40
Type-specific Array used for fast access into the data held by a Buffer.
Definition: Array.h:107
Implementation of osg-based BoxProxy.
BoxProxy(const agx::Vec3 &halfExtents, RenderProxyFactory::ShapeData< osg::Box > box, RenderProxyFactory *factory)
Implementation of osg-based CapsuleProxy.
CapsuleProxy(float radius, float height, RenderProxyFactory::ShapeData< osg::Capsule > data, RenderProxyFactory *factory)
Implementation of osg-based ConeProxy.
ConeProxy(float radius, float height, RenderProxyFactory::ShapeData< osg::Cone > data, RenderProxyFactory *factory)
Implementation of batch rendering of contact points.
virtual void reset() override
Will reset color, alpha and enabled state back to default state (as when initially created).
ContactProxy(osg::Geode *geode, const agxCollide::GeometryContactPtrVector *contacts, agxOSG::RenderProxyFactory *factory)
Class that handles batch rendering of objects in forward iterator compliant container.
void clear()
Reset container pointer and removes all child transforms.
void setContainer(const ContainerType *container)
Assign compatible container.
ContainerShapeBatchRenderer(osg::Geode *geode, const ContainerType *container, agxOSG::RenderProxyFactory *factory, agxRender::RenderProxy *proxy)
Construct given shape composite and compatible container.
void update(bool addScaleTransform=false)
Updates transforms.
agx::Vec3f findScale(const typename ContainerType::value_type &val) const
Find scale (agx::Vec3) given container value type.
agx::AffineMatrix4x4 findTransform(const typename ContainerType::value_type &val) const
Find transform (agx::AffineMatrix4x4) given container value type.
virtual ~ContainerShapeBatchRenderer()
Destructor.
Implementation of osg-based CylinderProxy.
CylinderProxy(float radius, float height, RenderProxyFactory::ShapeData< osg::Cylinder > data, RenderProxyFactory *factory)
Implementation of osg-based HeightfieldProxy.
virtual ~HeightFieldProxy()
Destructor.
HeightFieldProxy(agxCollide::HeightField *shape, RenderProxyFactory::ShapeData< osg::Geometry > hfData, RenderProxyFactory *factory)
void set(const agx::Vec2iVector &modifiedIndices, const agx::RealVector &heights) override
Override this method to support changing a selection of indices in the heightfield.
Implementation of osg-based HollowConeProxy.
HollowConeProxy(float topRadius, float bottomRadius, float height, float thickness, RenderProxyFactory::ShapeData< osg::Geometry > data, RenderProxyFactory *factory)
Implementation of osg-based HollowCylinderProxy.
HollowCylinderProxy(float outerRadius, float height, float thickness, RenderProxyFactory::ShapeData< osg::Geometry > data, RenderProxyFactory *factory)
Implementation of osg-based LineProxy.
LineProxy(const agx::Vec3 &p1, const agx::Vec3 &p2, RenderProxyFactory::ShapeData< osg::Geometry > line, RenderProxyFactory *factory)
Class for handling methods related to OSG such as setColor, setTransform etc.
OSGData(agxOSG::RenderProxyFactory *factory, agxRender::RenderProxy *proxy)
agx::AffineMatrix4x4 m_invTransform
void setEnableOSG(bool flag)
Enable/disable rendering.
void setTransformOSG(const agx::AffineMatrix4x4 &transform)
Transform a node.
RenderProxyFactory::ShapeData< T > m_data
void setAlphaOSG(float transparency)
Set the alpha value.
void setRenderModeOSG(agxRender::RenderProxy::RenderMode mode)
Change the render mode.
osg::ref_ptr< osg::MatrixTransform > m_transformNode
agxRender::RenderProxy * m_proxy
void onRemoveOSG()
Remove the node from all its parents.
osg::MatrixTransform * getNode()
\ return the node for this RenderProxy
OSGData(const RenderProxyFactory::ShapeData< T > &data, RenderProxyFactory *factory, agxRender::RenderProxy *proxy)
agxOSG::RenderProxyFactory * m_factory
void setColorOSG(const agx::Vec3 &color, float alpha)
Set the color and alpha value.
Implementation of osg-based PlaneProxy.
PlaneProxy(const agx::Vec3 &normal, agx::Real distance, RenderProxyFactory::ShapeData< osg::Geometry > data, RenderProxyFactory *factory)
Implementation of the abstract class from the agxRender namespace, this class is responsible for crea...
void setRenderMode(agxRender::RenderProxy *proxy, osg::Node *node, agxRender::RenderProxy::RenderMode mode)
Set the RenderMode for a specified node.
void addChild(osg::Node *node, agxRender::RenderProxy::RenderMode mode)
Add a child to the root, default getDefaultRenderMode() will be used for determining if the node shou...
const agx::AffineMatrix4x4 & getGlobalTransform() const
Implementation of batch rendering of rigid body center of mass position.
RigidBodyBatchRenderProxy(osg::Geode *geode, const ContainerType *container, agxOSG::RenderProxyFactory *factory)
virtual void reset() override
Will reset color, alpha and enabled state back to default state (as when initially created).
Base class for batch rendering of any shape or shape composite.
ShapeBatchRenderer(osg::Geode *geode, agxOSG::RenderProxyFactory *factory, agxRender::RenderProxy *proxy)
Construct given geode.
ShapeBatchRenderer(osg::Shape *shape, agxOSG::RenderProxyFactory *factory, agxRender::RenderProxy *proxy)
Construct given single shape.
void prepare(size_t numObjects)
Prepare the root transform with the current amount of child nodes.
void setScale(float scale)
Assign transform scale.
void setTransform(TransformType *obj, const agx::AffineMatrix4x4 &transform, const agx::Vec3f &scale)
Assign transform (given agx type) to a supported osg transform.
osg::ref_ptr< osg::Geode > m_geode
void clear()
Clear the root transform node from all child transforms.
void prepareWithScale(size_t numObjects)
Including scale transform.
virtual ~ShapeBatchRenderer()
Destructor.
Implementation of osg-based SphereProxy.
SphereProxy(float radius, RenderProxyFactory::ShapeData< osg::Sphere > sphere, RenderProxyFactory *factory)
Implementation of osg-based TextProxy.
TextProxy(const agx::String &text, const agx::Vec3 &pos, RenderProxyFactory::ShapeData< osgText::Text > data, RenderProxyFactory *factory)
Implementation of osg-based TrimeshProxy.
TrimeshProxy(agxCollide::Trimesh *mesh, RenderProxyFactory::ShapeData< osg::TriangleMesh > data, RenderProxyFactory *factory)
Implementation of osg-based TruncatedConeProxy.
TruncatedConeProxy(float topRadius, float bottomRadius, float height, RenderProxyFactory::ShapeData< osg::Geometry > data, RenderProxyFactory *factory)
osg::MatrixTransform * getSphereTransform()
void setRenderModeOSG(agxRender::RenderProxy::RenderMode mode)
WireRenderProxy(float radius, const agx::Vec3 &color, osg::Geode *segmentGeode, osg::Geode *edgeGeode, osg::Geode *nodeGeode, agxOSG::RenderProxyFactory *factory)
void setColorOSG(const agx::Vec3 &color, float alpha)
osg::MatrixTransform * getSegmentTransform()
ContainerShapeBatchRenderer< agxRender::WireRenderProxy::SegmentDefContainer, osg::MatrixTransform > m_segmentBatch
ContainerShapeBatchRenderer< agxRender::WireRenderProxy::SegmentDefContainer, osg::MatrixTransform > m_edgeBatch
virtual void onRemoveNotification() override
Called when the wire is removed from the simulation.
ContainerShapeBatchRenderer< agxRender::WireRenderProxy::SphereDefContainer, osg::MatrixTransform > m_sphereBatch
virtual void onAddNotification() override
Called when the wire is added to the simulation.
virtual void reset() override
Will reset color, alpha and enabled state back to default state (as when initially created).
osg::MatrixTransform * getEdgeTransform()
void setEnableOSG(bool flag)
void setAlphaOSG(float transparency)
void setTransformOSG(const agx::AffineMatrix4x4 &transform)
Implementation of osg-based WireShapeProxy.
WireShapeProxy(float radius, float height, const agx::Vec3 &previousEndPoint0, const agx::Vec3 &previousEndPoint1, RenderProxyFactory::ShapeData< osg::CompositeShape > data, RenderProxyFactory *factory)
Subclass that implements a BoxProxy.
Subclass that implements a CapsuleProxy.
Subclass that implements a ConeProxy.
Class holding contacts that makes it possible to batch render these objects.
Subclass that implements a CylinderProxy.
Subclass that implements a HeightfieldProxy.
Subclass that implements a HollowConeProxy.
Subclass that implements a CylinderProxy.
Subclass that implements a LineProxy.
Subclass that implements a PlaneProxy.
Abstract base class which encapsulated information for rendering a specific shape.
virtual void setTransform(const agx::AffineMatrix4x4 &transform)
Set the transform of this RenderProxy, if overridden, set the m_transform and call onUpdate(TRANSFORM...
Class holding rigid bodies that makes it possible to batch render these objects.
agxRender::RigidBodyBatchRenderProxy::Container m_bodies
Subclass that implements a SphereProxy.
Subclass that implements a TextProxy.
Subclass that implements a TrimeshProxy.
Subclass that implements a TruncatedConeProxy.
Subclass that implements a WireShapeProxy.
static AffineMatrix4x4T< Real > translate(const Vec3T< Real > &dv)
Return a matrix which translates according to dv.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:49
const agx::AffineMatrix4x4 & getCmTransform() const
Convenience methods for center of mass frame.
Definition: RigidBody.h:1183
Vector containing 'raw' data.
Definition: agx/Vector.h:246
#define agxAssert(expr)
Definition: debug.h:143
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
double Real
Definition: Real.h:41
AffineMatrix4x4T< Real > AffineMatrix4x4
Vec3T< Real32 > Vec3f
Definition: agx/Vec3.h:39
AGXPHYSICS_EXPORT agx::Bool equivalent(const agx::AddedMassInteraction::Matrix6x6 &lhs, const agx::AddedMassInteraction::Matrix6x6 &rhs, agx::Real eps=agx::RealEpsilon)
Class for storing OSG specific data for each RenderProxy.