erebus
annotate liberebus/src/object.h @ 44:a2afaf8af09b
helpful comment
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 18 Sep 2015 06:47:41 +0300 |
parents | 93894c232d65 |
children | bab25c0ce337 |
rev | line source |
---|---|
nuclear@2 | 1 #ifndef OBJECT_H_ |
nuclear@2 | 2 #define OBJECT_H_ |
nuclear@2 | 3 |
nuclear@2 | 4 #include <string> |
nuclear@2 | 5 #include "vmath/ray.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@17 | 20 Vector3 calc_normal() const; |
nuclear@17 | 21 Vector3 calc_tangent() const; |
nuclear@17 | 22 Vector2 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_ |