// GeomObj.h: interface for the GeomObj class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GEOMOBJ_H__DE164633_2D68_438D_BF03_3FF0BA38F4C0__INCLUDED_)
#define AFX_GEOMOBJ_H__DE164633_2D68_438D_BF03_3FF0BA38F4C0__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

//#include <iostream>
//#include <fstream>
#include <strstream>

#include "Ray.h"

// @@@@@@@@@@@@@@@@@@@@@ Color3 class @@@@@@@@@@@@@@@@
class Color3 { // holds an red,green,blue 3-tuple
public:
	float red, green, blue;
	Color3(){red = green = blue = 0;}
	Color3(float r, float g, float b){red = r; green = g; blue = b;}
	Color3(const Color3& c){red = c.red; green = c.green; blue = c.blue;}
	void set(float r, float g, float b);
	void set(const Color3 c);
	void add(float r, float g, float b);
	Color3 operator*(float c);
	Color3 operator*(const Color3& c);
	void add(const Color3& src, const Color3& refl);
	void add(const Color3& colr);
	void build4tuple(float v[]);
};

//@@@@@@@@@@@@@@@@@ Material class @@@@@@@@@@@@@@
class Material{
public:
	Color3 ambient, diffuse, specular, emissive;
	int numParams; // for textures
	float params[10]; // for textures
	int textureType;  // 0 for none, neg for solids, pos for images
	float specularExponent, reflectivity, transparency, speedOfLight;
	float specularFraction, surfaceRoughness;
	void setDefault();
	void set(Material& m);
}; // end of Material

//@@@@@@@@@@@@@@@@@@@@@ GeomObj class @@@@@@@@@@@@@@@@
class GeomObj{
public:
		//IntRect scrnExtnt;
		GeomObj * next;
		GeomObj();
		virtual void loadStuff(){}
		virtual void drawOpenGL(){}
 		virtual void tellMaterialsGL(){}
		virtual bool hit(Ray& ray, Intersection& inter){return false;}
		virtual bool hit(Ray& ray){Intersection i; return hit(ray, i);}
};

#endif // !defined(AFX_GEOMOBJ_H__DE164633_2D68_438D_BF03_3FF0BA38F4C0__INCLUDED_)
