Sceneview
 All Classes Functions Variables Enumerations Enumerator Groups Pages
group_node.hpp
1 // Copyright [2015] Albert Huang
2 
3 #ifndef SCENEVIEW_GROUP_NODE_HPP__
4 #define SCENEVIEW_GROUP_NODE_HPP__
5 
6 #include <vector>
7 
8 #include <sceneview/scene_node.hpp>
9 #include <sceneview/axis_aligned_box.hpp>
10 
11 namespace sv {
12 
13 class Scene;
14 
26 class GroupNode : public SceneNode {
27  public:
28  virtual ~GroupNode() {}
29 
33  SceneNodeType NodeType() const override {
34  return SceneNodeType::kGroupNode; }
35 
39  const std::vector<SceneNode*>& Children() { return children_; }
40 
41  const AxisAlignedBox& WorldBoundingBox() override;
42 
43  protected:
44  void TransformChanged() override;
45 
46  private:
47  friend class Scene;
48 
49  explicit GroupNode(const QString& name);
50 
51  SceneNode* AddChild(SceneNode* child);
52 
53  void CopyAsChildren(Scene* scene, GroupNode* root);
54 
55  void RemoveChild(SceneNode* child);
56 
57  std::vector<SceneNode*> children_;
58 
59  AxisAlignedBox bounding_box_;
60  bool bounding_box_dirty_;
61 };
62 
63 } // namespace sv
64 
65 #endif // SCENEVIEW_GROUP_NODE_HPP__
A scene graph node that can have children.
Definition: group_node.hpp:26
void TransformChanged() override
Internal method, used to enable lazy matrix computations.
Pure virtual class that all scene graph nodes inherit.
Definition: scene_node.hpp:41
An axis-aligned box typically used for bounding box and intersection calculations.
Definition: axis_aligned_box.hpp:17
const AxisAlignedBox & WorldBoundingBox() override
Retrieve the world-space bounding box of the node and all of its children (if applicable).
A scene graph.
Definition: scene.hpp:36
SceneNodeType
Specifies a scene node type.
Definition: scene_node.hpp:19
const std::vector< SceneNode * > & Children()
Retrieve the node's children.
Definition: group_node.hpp:39
SceneNodeType NodeType() const override
Definition: group_node.hpp:33