#pragma once
#include "../stdafx.h"
#include "glLibLocals.h"
#include "glLibTexturing/glLibTexturing.h"

class glLibMaterial {
	friend class glLibObjectPlane;
	friend class glLibObjectRectangularSolid;
	public:
		double Tf[3]; //Transmission Filter
		GLfloat Ka[4]; //Ambient Component
		GLfloat Kd[4]; //Diffuse Component
		GLfloat Ks[4]; //Specular Component
		double Ni; //Index of Refraction, std: [0.001, 10.0]
		GLfloat Ns; //Shininess Coefficient
		glLibTexture2D* texture; //Texture
		string name; //Material Name
	private:
		bool force_texture;

	public:
		void glLibInternal_init_defaults(void);
		void glLibInternal_init_vars(void);
		
		glLibMaterial(void);
		glLibMaterial(glLibFlagMaterial material_name);
		~glLibMaterial(void);
		
		void check_material(void);
		
		void use(void);
	
	private:
		//This will prevent copying or assigning, which doesn't really make sense.
		//To make a reference to a material, use the reference(...) method instead.
		//Must be protected so derived classes' auto-generated functions will work.
		glLibMaterial(const glLibMaterial& copy_mat) {
			throw glLibError("A material's copy constructor was somehow used!");
		}
		glLibMaterial& operator=(glLibMaterial const &assign_mat) {
			throw glLibError("A material's assignment operator was somehow used!");
			return *this;
		}
};

void glLibPushMaterial(void);

void glLibPopMaterial(void);

void glLibUseMaterial(glLibMaterial* mat);