AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
GeometryNode.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. 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>
20
21#include <agxCollide/Geometry.h>
22#include <agxCollide/Space.h>
23
24#include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
25#include <osg/MatrixTransform>
26#include <osg/observer_ptr>
27#include <agx/PopDisableWarnings.h> // End of disabled warnings.
28
29namespace agxOSG
30{
31
32 class Node;
33
41 class AGXOSG_EXPORT GeometryNode : public osg::MatrixTransform
42 {
43 public:
44
46 {
47 RENDER_DATA=0x1,
48 GEOMETRY_DATA=0x2
49 };
50
53
59
65
70
75 bool getAutoRemove() const { return m_autoRemove; }
76
81 void setAutoRemove( bool flag ) { m_autoRemove = flag; }
82
83 virtual osg::Object* cloneType() const { return new GeometryNode (); }
84 virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new GeometryNode (*this,copyop); }
85 virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const GeometryNode *>(obj)!=nullptr; }
86 virtual const char* className() const { return "MatrixTransform"; }
87 virtual const char* libraryName() const { return "osg"; }
88
89 virtual void traverse(osg::NodeVisitor& nv);
90
92 GeometryNode( const GeometryNode& node, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY );
93
96
99
106 void setRenderChild(RenderFlag flag, osg::Node *node);
107
108
113 osg::Node *getRenderChild(RenderFlag flag);
114
119 const osg::Node *getRenderChild(RenderFlag flag) const;
120
125
126 public:
128
129 protected:
130 // agxCollide::Space::Event::CallbackType m_removeGeometryCallback;
132
134
135 virtual ~GeometryNode();
136
137 osg::ref_ptr<osg::Group> m_geometryParent;
138 osg::ref_ptr<osg::Group> m_renderParent;
139 };
140
141
142} // Namespace agxOSG
143
#define AGXOSG_EXPORT
The geometry representation used by the collision detection engine.
Definition Geometry.h:92
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
Definition Space.h:82
A node that can be associated with a collision geometry so that the transformation of this node is up...
void setRenderChild(RenderFlag flag, osg::Node *node)
Set a child to this node so it can be toggled with the setRenderFlag.
virtual const char * libraryName() const
void setGeometry(agxCollide::Geometry *geometry)
Associate this node's transformation with the transformation of the specified geometry.
GeometryNode(agxCollide::Geometry *geometry)
Constructor that associates this node's transformation with the transformation of the specified geome...
void updateTransform()
Read the transform from the geometry and update the visual transform node.
void setAutoRemove(bool flag)
Specify whether this node should be removed when the destructor of the associated geometry is called.
GeometryNode(const GeometryNode &node, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
void removeNode(agxCollide::Space *space, agxCollide::Geometry *geometry)
virtual osg::Object * cloneType() const
bool getAutoRemove() const
RenderFlag getSelectedRenderChild() const
osg::ref_ptr< osg::Group > m_renderParent
agxCollide::Geometry::ShapeChangeEvent::CallbackType shapeCallback
virtual const char * className() const
virtual osg::Object * clone(const osg::CopyOp &copyop) const
const osg::Node * getRenderChild(RenderFlag flag) const
agx::observer_ptr< agxCollide::Geometry > m_geometry
void selectRenderChild(RenderFlag flag)
GeometryNode()
Default constructor.
virtual bool isSameKindAs(const osg::Object *obj) const
agxCollide::Geometry * getGeometry()
Get the associated geometry.
virtual void traverse(osg::NodeVisitor &nv)
osg::ref_ptr< osg::Group > m_geometryParent
osg::Node * getRenderChild(RenderFlag flag)
T CallbackType
Definition Event.h:37
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.