#include "ModelViewer.h"
#include "texture\TextureManager.h"

extern int LIGHT_QUALITY;
extern float LIGHT_SIZE;



ModelViewer::ModelViewer( void )
{
}
void ModelViewer::renderModels( GLPhongRender &render, vector<Light*> &lights, vector<Model*> &models )
{
	Camera<double> cam;
	cam.pos = CONVERT_TO_DOUBLE( this->camera.pos );
	cam.look = CONVERT_TO_DOUBLE( this->camera.look );
	cam.right = CONVERT_TO_DOUBLE( this->camera.right );


	render.beginFrame( cam );

	//sets global variables render light params
		LIGHT_QUALITY = 8;
		LIGHT_SIZE = 0.1;

		if ( render.isFragmentShaderValid() && render.isVertexShaderValid() )
		{
			render.renderPhongModels( lights, models );
		}
		else
		{
			render.renderModels( models );
		}

		render.renderLights( lights );
	
	render.endFrame();
}
void ModelViewer::renderModel( GLPhongRender &render, vector<Light*> &lights, Model &model )
{
	vector< Model* > models;
	models.push_back( &model );

	this->renderModels( render, lights, models );
}
