erebus
view liberebus/src/object.h @ 18:09028848f276
- implemented Box object intersection
- implemented interactive camera manipulation
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 26 May 2014 23:34:12 +0300 |
parents | 93894c232d65 |
children | bab25c0ce337 |
line source
1 #ifndef OBJECT_H_
2 #define OBJECT_H_
4 #include <string>
5 #include "vmath/ray.h"
7 class Object;
8 class SceneNode;
10 class RayHit {
11 public:
12 float dist;
13 Ray world_ray, local_ray;
15 const SceneNode *node;
16 const Object *obj, *subobj;
18 RayHit();
20 Vector3 calc_normal() const;
21 Vector3 calc_tangent() const;
22 Vector2 calc_texcoords() const;
23 };
25 enum class ObjType { null, geom, camera };
27 class Object {
28 private:
29 std::string name;
31 public:
32 Object();
33 virtual ~Object() = default;
35 virtual ObjType get_type() const;
37 virtual void set_name(const char *name);
38 virtual const char *get_name() const;
40 virtual bool intersect(const Ray &ray, RayHit *hit = 0) const;
41 };
43 #endif // OBJECT_H_