erebus
annotate liberebus/src/object.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 OBJECT_H_ |
nuclear@2 | 2 #define OBJECT_H_ |
nuclear@2 | 3 |
nuclear@2 | 4 #include <string> |
nuclear@45 | 5 #include <gmath/gmath.h> |
nuclear@2 | 6 |
nuclear@2 | 7 class Object; |
nuclear@17 | 8 class SceneNode; |
nuclear@2 | 9 |
nuclear@17 | 10 class RayHit { |
nuclear@17 | 11 public: |
nuclear@2 | 12 float dist; |
nuclear@4 | 13 Ray world_ray, local_ray; |
nuclear@2 | 14 |
nuclear@17 | 15 const SceneNode *node; |
nuclear@2 | 16 const Object *obj, *subobj; |
nuclear@17 | 17 |
nuclear@17 | 18 RayHit(); |
nuclear@17 | 19 |
nuclear@46 | 20 Vec3 calc_normal() const; |
nuclear@46 | 21 Vec3 calc_tangent() const; |
nuclear@46 | 22 Vec2 calc_texcoords() const; |
nuclear@2 | 23 }; |
nuclear@2 | 24 |
nuclear@2 | 25 enum class ObjType { null, geom, camera }; |
nuclear@2 | 26 |
nuclear@2 | 27 class Object { |
nuclear@2 | 28 private: |
nuclear@2 | 29 std::string name; |
nuclear@2 | 30 |
nuclear@2 | 31 public: |
nuclear@2 | 32 Object(); |
nuclear@2 | 33 virtual ~Object() = default; |
nuclear@2 | 34 |
nuclear@2 | 35 virtual ObjType get_type() const; |
nuclear@2 | 36 |
nuclear@2 | 37 virtual void set_name(const char *name); |
nuclear@2 | 38 virtual const char *get_name() const; |
nuclear@2 | 39 |
nuclear@2 | 40 virtual bool intersect(const Ray &ray, RayHit *hit = 0) const; |
nuclear@2 | 41 }; |
nuclear@2 | 42 |
nuclear@2 | 43 #endif // OBJECT_H_ |