DART  6.10.1
ShapeNode.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2021, The DART development contributors
3  * All rights reserved.
4  *
5  * The list of contributors can be found at:
6  * https://github.com/dartsim/dart/blob/master/LICENSE
7  *
8  * This file is provided under the following "BSD-style" License:
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef DART_GUI_OSG_RENDER_SHAPEGEODE_HPP_
34 #define DART_GUI_OSG_RENDER_SHAPEGEODE_HPP_
35 
36 #include <memory>
37 #include <osg/Node>
38 
39 namespace dart {
40 
41 namespace dynamics {
42 class Shape;
43 class ShapeFrame;
44 class SimpleFrame;
45 class VisualAspect;
46 } // namespace dynamics
47 
48 namespace gui {
49 namespace osg {
50 
51 class Node;
52 class Group;
53 class EntityNode;
54 class ShapeFrameNode;
55 
56 namespace render {
57 
58 class ShapeNode
59 {
60 public:
61  ShapeNode(
62  std::shared_ptr<dart::dynamics::Shape> shape,
63  ShapeFrameNode* parentNode,
64  ::osg::Node* node);
65 
66  virtual ~ShapeNode();
67 
69  const std::shared_ptr<dart::dynamics::Shape>& getShape() const;
70 
72 
74 
76 
78  ::osg::Node* getNode();
79 
81  const ::osg::Node* getNode() const;
82 
85 
88 
90  virtual void refresh() = 0;
91 
93  bool wasUtilized() const;
94 
96  void clearUtilization();
97 
98 protected:
100  const std::shared_ptr<dart::dynamics::Shape> mShape;
101 
104 
107 
110 
112  ::osg::Node* mNode;
113 
117  bool mUtilized;
118 };
119 
120 } // namespace render
121 } // namespace osg
122 } // namespace gui
123 } // namespace dart
124 
125 #endif // DART_GUI_OSG_RENDER_SHAPEGEODE_HPP_
Definition: ShapeFrame.hpp:192
Definition: ShapeFrame.hpp:54
Definition: ShapeFrameNode.hpp:61
Definition: ShapeNode.hpp:59
virtual ~ShapeNode()
Definition: ShapeNode.cpp:57
dart::dynamics::VisualAspect * getVisualAspect()
Definition: ShapeNode.cpp:75
ShapeFrameNode * getParentShapeFrameNode()
Pointer to the parent EntityNode of this ShapeNode.
Definition: ShapeNode.cpp:99
const dart::dynamics::ShapeFrame * getShapeFrame() const
Definition: ShapeNode.cpp:69
const std::shared_ptr< dart::dynamics::Shape > mShape
Pointer to the Shape associated with this ShapeNode.
Definition: ShapeNode.hpp:100
ShapeFrameNode * mParentShapeFrameNode
Pointer to the parent ShapeFrameNode of this ShapeNode.
Definition: ShapeNode.hpp:109
dart::dynamics::VisualAspect * mVisualAspect
Pointer to the VisualAspect associated with this ShapeNode.
Definition: ShapeNode.hpp:106
bool wasUtilized() const
True iff this ShapeNode has been utilized on the latest update.
Definition: ShapeNode.cpp:111
const std::shared_ptr< dart::dynamics::Shape > & getShape() const
Pointer to the Shape associated with this ShapeNode.
Definition: ShapeNode.cpp:63
::osg::Node * mNode
Should generally be equal to 'this'.
Definition: ShapeNode.hpp:112
ShapeNode(std::shared_ptr< dart::dynamics::Shape > shape, ShapeFrameNode *parentNode, ::osg::Node *node)
Definition: ShapeNode.cpp:42
virtual void refresh()=0
Update all rendering data for this ShapeNode.
::osg::Node * getNode()
Cast this ShapeNode into an osg::Node.
Definition: ShapeNode.cpp:87
void clearUtilization()
Set mUtilized to false.
Definition: ShapeNode.cpp:117
bool mUtilized
True iff this ShapeNode has been utilized on the latest update.
Definition: ShapeNode.hpp:117
dart::dynamics::ShapeFrame * mShapeFrame
Pointer to the SimpleFrame associated with this ShapeNode.
Definition: ShapeNode.hpp:103
Definition: BulletCollisionDetector.cpp:65