erebus

view liberebus/src/snode.h @ 3:a932848de652

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 28 Apr 2014 15:44:59 +0300
parents 474a0244f57d
children 93894c232d65
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 void add_child(SceneNode *node);
24 bool remove_child(SceneNode *node);
26 int get_num_children() const;
27 SceneNode *get_child(int idx) const;
29 void set_position(const Vector3 &pos);
30 void set_rotation(const Quaternion &rot);
31 void set_scaling(const Vector3 &scale);
33 const Vector3 &get_node_position() const;
34 const Quaternion &get_node_rotation() const;
35 const Vector3 &get_node_scaling() const;
37 Vector3 get_position() const;
38 Quaternion get_rotation() const;
39 Vector3 get_scaling() const;
41 const Matrix4x4 &get_matrix() const;
42 const Matrix4x4 &get_inv_matrix() const;
44 void update_node(long msec = 0);
45 void update(long msec = 0);
47 bool intersect(const Ray &ray, RayHit *hit) const;
48 };
50 #endif // SNODE_H_