nuclear@2: #ifndef SNODE_H_ nuclear@2: #define SNODE_H_ nuclear@2: nuclear@2: #include nuclear@2: #include "object.h" nuclear@45: #include "gmath/gmath.h" nuclear@2: nuclear@2: class SceneNode { nuclear@2: private: nuclear@2: Vector3 pos; nuclear@2: Quaternion rot; nuclear@2: Vector3 scale; nuclear@2: nuclear@2: std::vector obj; nuclear@2: nuclear@2: SceneNode *parent; nuclear@2: std::vector children; nuclear@2: nuclear@3: Matrix4x4 xform; nuclear@3: Matrix4x4 inv_xform; nuclear@2: nuclear@2: public: nuclear@4: SceneNode(); nuclear@4: explicit SceneNode(Object *obj); nuclear@4: nuclear@2: void add_child(SceneNode *node); nuclear@2: bool remove_child(SceneNode *node); nuclear@2: nuclear@2: int get_num_children() const; nuclear@2: SceneNode *get_child(int idx) const; nuclear@2: nuclear@4: SceneNode *get_parent() const; nuclear@4: nuclear@4: void add_object(Object *obj); nuclear@4: int get_num_objects() const; nuclear@4: Object *get_object(int idx) const; nuclear@4: nuclear@2: void set_position(const Vector3 &pos); nuclear@2: void set_rotation(const Quaternion &rot); nuclear@2: void set_scaling(const Vector3 &scale); nuclear@2: nuclear@2: const Vector3 &get_node_position() const; nuclear@2: const Quaternion &get_node_rotation() const; nuclear@2: const Vector3 &get_node_scaling() const; nuclear@2: nuclear@2: Vector3 get_position() const; nuclear@2: Quaternion get_rotation() const; nuclear@2: Vector3 get_scaling() const; nuclear@2: nuclear@3: const Matrix4x4 &get_matrix() const; nuclear@3: const Matrix4x4 &get_inv_matrix() const; nuclear@3: nuclear@2: void update_node(long msec = 0); nuclear@2: void update(long msec = 0); nuclear@2: nuclear@2: bool intersect(const Ray &ray, RayHit *hit) const; nuclear@2: }; nuclear@2: nuclear@2: #endif // SNODE_H_