erebus

view liberebus/src/snode.h @ 47:4b91c9a501d8

minor fix of strange code structure in the thread func
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 01 Feb 2016 14:56:15 +0200
parents 93894c232d65
children c4d48a21bc4a
line source
1 #ifndef SNODE_H_
2 #define SNODE_H_
4 #include <vector>
5 #include "object.h"
6 #include "gmath/gmath.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_