/////// // // kirtrace.hpp // // header for actual tracing code... // // stat: 2 final // // note #defines here to turn new features on/off and control params // #ifndef _KIRAY_ #define _KIRAY_ #include "object.hpp" #include "light.hpp" #include "camera.hpp" #include "ppmgl2d.hpp" #define MAXAGE 3 //maximum number of ray bounces #define MAXDIST 100000 //maximum ray travel distance #define ANTIALIAS #define GLOSSY #define GLOSSFACTOR 0.06 #define GLOSSNUM 6 #define SOFTSHADOW #define SOFTNUM 6 #define TEXTURE class kiray : public ppmGL2d { public: object* *objs; // object list int numObjs; light* *lights; // light list int numLights; Vec3f bg; // default "infinite distance" color Camera Cam; // camera, currently from camera.hpp unsigned char* Texture; //yes, having this stuff here is awful int texW, texH; kiray(int W, int H, object* *o, int numo, light* *l, int numl, unsigned char* Tex, int tw, int th) : ppmGL2d(W,H) { objs = o; numObjs = numo; lights = l; numLights = numl; Texture = Tex; texW = tw; texH = th; bg.Set(0,0,0); // set default black background } void traceAll(); Vec3f traceRay(Vec3f &start, Vec3f &dir, int age, int out); //age is number of bounces to this ray, //out is (outside object ? 1 : 0) int getObject(Vec3f &start, Vec3f &dir, object **hitObject, float *hitTime); Vec3f shadowray(Vec3f &start, Vec3f &dir, float lightDist); }; #endif