erebus

view liberebus/src/object.h @ 31:53a98c148bf8

- introduced SurfaceGeometry to carry all the geometric information input to BRDF sampling and evaluation functions. - made Reflectance keep an (optional) pointer to its material - simplified PhongRefl::sample_dir, with the help of SurfaceGeometry - worked around microsoft's broken std::thread implementation's deadlock on join
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 07 Jun 2014 09:14:17 +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_