erebus
view liberebus/src/snode.h @ 44:a2afaf8af09b
helpful comment
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 18 Sep 2015 06:47:41 +0300 |
parents | a932848de652 |
children | bab25c0ce337 |
line source
1 #ifndef SNODE_H_
2 #define SNODE_H_
4 #include <vector>
5 #include "object.h"
6 #include "vmath/vmath.h"
8 class SceneNode {
9 private:
10 Vector3 pos;
11 Quaternion rot;
12 Vector3 scale;
14 std::vector<Object*> obj;
16 SceneNode *parent;
17 std::vector<SceneNode*> children;
19 Matrix4x4 xform;
20 Matrix4x4 inv_xform;
22 public:
23 SceneNode();
24 explicit SceneNode(Object *obj);
26 void add_child(SceneNode *node);
27 bool remove_child(SceneNode *node);
29 int get_num_children() const;
30 SceneNode *get_child(int idx) const;
32 SceneNode *get_parent() const;
34 void add_object(Object *obj);
35 int get_num_objects() const;
36 Object *get_object(int idx) const;
38 void set_position(const Vector3 &pos);
39 void set_rotation(const Quaternion &rot);
40 void set_scaling(const Vector3 &scale);
42 const Vector3 &get_node_position() const;
43 const Quaternion &get_node_rotation() const;
44 const Vector3 &get_node_scaling() const;
46 Vector3 get_position() const;
47 Quaternion get_rotation() const;
48 Vector3 get_scaling() const;
50 const Matrix4x4 &get_matrix() const;
51 const Matrix4x4 &get_inv_matrix() const;
53 void update_node(long msec = 0);
54 void update(long msec = 0);
56 bool intersect(const Ray &ray, RayHit *hit) const;
57 };
59 #endif // SNODE_H_