erebus

annotate liberebus/src/snode.h @ 48:9971a08f4104

merged
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 24 Feb 2016 00:29:31 +0200
parents bab25c0ce337
children
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@45 6 #include "gmath/gmath.h"
nuclear@2 7
nuclear@2 8 class SceneNode {
nuclear@2 9 private:
nuclear@46 10 Vec3 pos;
nuclear@46 11 Quat rot;
nuclear@46 12 Vec3 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@46 19 Mat4x4 xform;
nuclear@46 20 Mat4x4 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@46 38 void set_position(const Vec3 &pos);
nuclear@46 39 void set_rotation(const Quat &rot);
nuclear@46 40 void set_scaling(const Vec3 &scale);
nuclear@2 41
nuclear@46 42 const Vec3 &get_node_position() const;
nuclear@46 43 const Quat &get_node_rotation() const;
nuclear@46 44 const Vec3 &get_node_scaling() const;
nuclear@2 45
nuclear@46 46 Vec3 get_position() const;
nuclear@46 47 Quat get_rotation() const;
nuclear@46 48 Vec3 get_scaling() const;
nuclear@2 49
nuclear@46 50 const Mat4x4 &get_matrix() const;
nuclear@46 51 const Mat4x4 &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_