
/* class declaration of the main raytracer class*/



class ray_tracer
{
void shade(xyz *hit_point,xyz *ray,xyz *normal,surface *surf,color *point_color,int object_hit,color* spec_color);
void viewing();
public:
xyz *s_xaxis,*s_yaxis;
xyz *start_ray;
xyz camera,focus,up_vector;
object *objects[10];
light *lights[10];
color background_color;
int hor_res,ver_res,hor_fov,ver_fov,max_level,samples,super_sampling_type,prev_object_hit_primaryray;
//int max_object,max_light,max_surface;
int cur_object,cur_light,cur_surface,cur_level,flag,prev_object_hit,prev_obscure,cur_obscure,enable_texturing;
double medium_refractiveindex,magnitude_x,magnitude_y;
surface surface1,surface2,surface3,surface4,surface5;
texture tex;
int shadow_samples;
color *texture_color;

//180 -70 300
	ray_tracer():camera(110.0,0.0,-190.0),focus(170.0,-30.0,-235.0),up_vector(0,1.0,0.0),background_color(0,0,0),surface1(),surface2(),surface3(),surface4(),tex()
	{

		cur_object  = 0;
		cur_light   = 0;
		cur_surface = 0;
		hor_res     = 512;
		ver_res     = 512;
		hor_fov		= 55;
		ver_fov		= 55;
		max_level	= 4;
		flag		= 0;

		
		super_sampling_type=0; /* 0-adaptive supersampling, 1-non adaptive supersampling,
							   super_sampling_type = 0 & samples=1 -without any supersampling */
		samples		= 2;
		medium_refractiveindex=1;
		enable_texturing=0;    //0 -turns off texture mapping   1-turns on texture mapping
		prev_object_hit=-1;
		prev_object_hit_primaryray=-2;
		prev_obscure=0;

		shadow_samples = 8;   //number of samples for soft shadows
		
		//origin		= &camera;
	surface1.ar=0;		//dark green
	surface1.ag=0;
	surface1.ab=0;
	surface1.dr=0;
	surface1.dg=142;
	surface1.db=72;
	surface1.sr=55;
	surface1.sg=55;
	surface1.sb=55;
	surface1.glassy=0;
	surface1.spec_coef=20; 
	surface1.diffuse=0;
	surface1.reflectivity=.2;
	surface1.refractive_index=1.4;

	surface2.ar=0;	//texture map 
	surface2.ag=0;
	surface2.ab=0;
	surface2.dr=100;
	surface2.dg=40;
	surface2.db=5;
	surface2.sr=50;
	surface2.sg=50;
	surface2.sb=50;
	surface2.reflectivity=0;
	surface2.spec_coef=15;
	surface2.texture=1;

	surface3.ar=0;		//transparent
	surface3.ag=0;
	surface3.ab=0;
	surface3.dr=240;
	surface3.dg=39;
	surface3.db=1;
	surface3.sr=200;
	surface3.sg=200;
	surface3.sb=200;
	surface3.spec_coef=15;
    surface3.diffuse=0;
	surface3.glassy=.5;
	surface3.reflectivity=0;
	surface3.refractive_index=1.33;

	surface4.ar=0;		//red
	surface4.ag=0;
	surface4.ab=0;
	surface4.dr=240;
	surface4.dg=39;
	surface4.db=1;
	surface4.sr=55;
	surface4.sg=55;
	surface4.sb=55;
	surface4.glassy=0;
	surface4.spec_coef=20; 
	surface4.diffuse=1;
	surface4.reflectivity=0;
	surface4.refractive_index=1.4;

	surface5.ar=0;		//yellow
	surface5.ag=0;
	surface5.ab=0;
	surface5.dr=230;
	surface5.dg=254;
	surface5.db=3;
	surface5.sr=55;
	surface5.sg=55;
	surface5.sb=55;
	surface5.glassy=0;
	surface5.spec_coef=20; 
	surface5.diffuse=1;
	surface5.reflectivity=0;
	surface5.refractive_index=1.4;

	}

	void set_up();  //returns a ray object reference to start_ray,s_xaxis,s_yaxis,equivalent to the viwing function

	color get_intersection(int source,xyz* ray,xyz* origin);//call for each ray in the event loop
	
	



};

