erebus

annotate liberebus/src/snode.h @ 5:9621beb22694

huh?
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 24 May 2014 02:20:44 +0300
parents a932848de652
children bab25c0ce337
rev   line source
nuclear@2 1 #ifndef SNODE_H_
nuclear@2 2 #define SNODE_H_
nuclear@2 3
nuclear@2 4 #include <vector>
nuclear@2 5 #include "object.h"
nuclear@2 6 #include "vmath/vmath.h"
nuclear@2 7
nuclear@2 8 class SceneNode {
nuclear@2 9 private:
nuclear@2 10 Vector3 pos;
nuclear@2 11 Quaternion rot;
nuclear@2 12 Vector3 scale;
nuclear@2 13
nuclear@2 14 std::vector<Object*> obj;
nuclear@2 15
nuclear@2 16 SceneNode *parent;
nuclear@2 17 std::vector<SceneNode*> children;
nuclear@2 18
nuclear@3 19 Matrix4x4 xform;
nuclear@3 20 Matrix4x4 inv_xform;
nuclear@2 21
nuclear@2 22 public:
nuclear@4 23 SceneNode();
nuclear@4 24 explicit SceneNode(Object *obj);
nuclear@4 25
nuclear@2 26 void add_child(SceneNode *node);
nuclear@2 27 bool remove_child(SceneNode *node);
nuclear@2 28
nuclear@2 29 int get_num_children() const;
nuclear@2 30 SceneNode *get_child(int idx) const;
nuclear@2 31
nuclear@4 32 SceneNode *get_parent() const;
nuclear@4 33
nuclear@4 34 void add_object(Object *obj);
nuclear@4 35 int get_num_objects() const;
nuclear@4 36 Object *get_object(int idx) const;
nuclear@4 37
nuclear@2 38 void set_position(const Vector3 &pos);
nuclear@2 39 void set_rotation(const Quaternion &rot);
nuclear@2 40 void set_scaling(const Vector3 &scale);
nuclear@2 41
nuclear@2 42 const Vector3 &get_node_position() const;
nuclear@2 43 const Quaternion &get_node_rotation() const;
nuclear@2 44 const Vector3 &get_node_scaling() const;
nuclear@2 45
nuclear@2 46 Vector3 get_position() const;
nuclear@2 47 Quaternion get_rotation() const;
nuclear@2 48 Vector3 get_scaling() const;
nuclear@2 49
nuclear@3 50 const Matrix4x4 &get_matrix() const;
nuclear@3 51 const Matrix4x4 &get_inv_matrix() const;
nuclear@3 52
nuclear@2 53 void update_node(long msec = 0);
nuclear@2 54 void update(long msec = 0);
nuclear@2 55
nuclear@2 56 bool intersect(const Ray &ray, RayHit *hit) const;
nuclear@2 57 };
nuclear@2 58
nuclear@2 59 #endif // SNODE_H_