All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SceneModelNode.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "VectorMath.h"
6 #include "SceneModelRenderable.h"
7 #include "SingleSphere.h"
8 #include "SceneModelNodeAnimation.h"
9 #include "SceneModelNodeVisitors.h"
10 #include "LayerIds.h"
11 #include <vector>
12 #include <string>
13 
14 namespace Eegeo
15 {
16  namespace Rendering
17  {
18  namespace SceneModels
19  {
21  {
22  public:
23 
24  SceneModelNode(std::string name);
25  ~SceneModelNode();
26 
27  void AddNode(SceneModelNode* pNode);
28  void RemoveNode(SceneModelNode* pNode);
29 
30  const std::string& GetName() const { return m_name; }
31  void SetName(const std::string& name);
32 
33  const size_t GetChildCount() const { return m_childNodes.size(); }
34 
35  SceneModelNode* GetChild(uint index) const;
36  SceneModelNode* GetNodeWithName(const std::string& name) const;
37 
38  void SetTransform(const m44& transform);
39  const m44& GetLocalTransform() const { return m_localTransform; }
40  const m44& GetWorldTransform() const { return m_worldTransform; }
41  virtual void UpdateTransforms(const dv3& ecefOrigin, const m44& parentTransform, bool dirtyParent);
42 
43  virtual void SetLayer(Rendering::LayerIds::Values layer);
44  virtual void SetDepthTestingRecursive(bool enabled);
45  virtual void SetDepthRangeRecursive(float near, float far);
46 
47  void SetAnimationData(ISceneModelNodeAnimation* pAnimationData);
48  ISceneModelNodeAnimation* GetAnimationData() const { return m_pAnimationData; }
49 
50  virtual void VisitForRendering(ISceneModelNodeRenderVisitor &visitor, const Rendering::RenderContext &renderContext, Eegeo::Rendering::RenderQueue &renderQueue);
51 
52  void SetBounds(const v3& center, const float radius);
53  void UpdateSphereRecursive();
54  const Geometry::SingleSphere& GetBoundingSphere() const { return m_worldBoundingSphere; }
55  const Geometry::SingleSphere& GetSubtreeBoundingSphere() const { return m_subtreeBoundingSphere; }
56 
57  virtual SceneModelNode* Clone(SceneModelNode* pNewParent);
58 
59  protected:
60 
61  void SetParent(SceneModelNode* pParent);
62 
63  std::string m_name;
64  SceneModelNode* m_pParentNode;
65  std::vector<SceneModelNode*> m_childNodes;
66 
67  m44 m_localTransform;
68  m44 m_worldTransform;
69 
70  bool m_transformDirty;
71 
72  dv3 m_ecefPosition;
73 
74  Geometry::SingleSphere m_localBoundingSphere;
75  Geometry::SingleSphere m_worldBoundingSphere;
76  Geometry::SingleSphere m_subtreeBoundingSphere;
77 
78  ISceneModelNodeAnimation* m_pAnimationData;
79  };
80  }
81  }
82 }