src/scene.h
branchpyrit
changeset 12 f4fcabf05785
parent 9 3239f749e394
child 14 fc18ac4833f2
equal deleted inserted replaced
11:4d192e13ee84 12:f4fcabf05785
    14 
    14 
    15 #include "vector.h"
    15 #include "vector.h"
    16 
    16 
    17 using namespace std;
    17 using namespace std;
    18 
    18 
       
    19 class Ray
       
    20 {
       
    21 public:
       
    22 	Vector3 a, dir;
       
    23 	Ray(const Vector3 &aa, const Vector3 &adir):
       
    24 		a(aa), dir(adir) {};
       
    25 };
       
    26 
    19 /* axis-aligned bounding box */
    27 /* axis-aligned bounding box */
    20 class BBox
    28 class BBox
    21 {
    29 {
    22 public:
    30 public:
    23 	Vector3 L;
    31 	Vector3 L;
    24 	Vector3 R;
    32 	Vector3 R;
    25 	BBox(): L(), R() {};
    33 	BBox(): L(), R() {};
    26 	float w() { return R.x-L.x; };
    34 	float w() { return R.x-L.x; };
    27 	float h() { return R.y-L.y; };
    35 	float h() { return R.y-L.y; };
    28 	float d() { return R.z-L.z; };
    36 	float d() { return R.z-L.z; };
    29 };
    37 	bool intersect(const Ray &ray, float &a, float &b);
    30 
       
    31 class Ray
       
    32 {
       
    33 public:
       
    34 	Vector3 a, dir;
       
    35 	Ray(const Vector3 &aa, const Vector3 &adir):
       
    36 		a(aa), dir(adir) {};
       
    37 };
    38 };
    38 
    39 
    39 class Light
    40 class Light
    40 {
    41 {
    41 public:
    42 public: