00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef CAMERARAY_H
00022
#define CAMERARAY_H
00023
00024
#include "ray.h"
00025
#include "insidelist.h"
00026
#include "intersection.h"
00027
#include "colour.h"
00028
#include "statistics.h"
00029
00030
class Scene;
00031
00036 class CameraRay:
public Ray {
00037
00038
public:
00039
00046
CameraRay(
const Vector3 o,
const Vector3 d,
Scene* s,
InsideList* l);
00047
00048 ~
CameraRay();
00049
00052 CameraRay(
const CameraRay& r):
00053
Ray(r), norm(r.norm), myscene(r.myscene), inside(new
InsideList(*r.inside)),
00054 hit(0), htime(0), ltime(0), hpoint(r.hpoint), hitstatus(NONE),
00055 tracelevel(r.tracelevel), weight(r.weight) {}
00056
00057
private:
00058
CameraRay& operator=(
const CameraRay&);
00059
00060
public:
00061
00064 FLT
getWeight() {
return weight;}
00065
00069 void scaleWeight(FLT s) {weight *= s;}
00070
00073
bool shoot();
00074
00079
bool refract(FLT weightmult);
00080
00084
void reflect(FLT weightmult);
00085
00088 Vector3 normal()
const {
return norm;}
00089
00092 Texture*
texture()
const {
return hit->
texture();}
00093
00096 Vector3 hitpoint()
const {
return hpoint;}
00097
00101
Colour evaluateMedia(
Colour& absorb)
const;
00102
00105 InsideList*
getInside()
const {
return inside;}
00106
00107
private:
00108
enum hitstatustype {NONE, OWN, OLD};
00109
00110
private:
00113
static HitStatistics statcount;
00114
00117
static HitStatistics statref;
00118
00119
private:
00120
00124
Vector3 norm;
00125
00126
Scene* myscene;
00127
InsideList* inside;
00128
Intersection* hit;
00129 DBL htime, ltime;
00130
Vector3 hpoint;
00131 hitstatustype hitstatus;
00132
int tracelevel;
00133 FLT weight;
00134
00135
private:
00136
void getIntersectionInfo();
00137
void deleteIntersectionInfo();
00138
00139 };
00140
00141
#endif