#ifndef GLPHONGRENDER_H
#define GLPHONGRENDER_H

#include "./../../lib/GLee/GLee.h"	
 #include <QGLContext>
#include "./renderer/Render.h"
#include "./illumination/tricol.h"
#include <iterator>

/// Advanced OpenGL render class. Can use shaders for per pixel model lighting.
/**
*	Advanced OpenGL render class, which is inherited from Render class.
*	The main difference from Render class is that this class does not render with
*	fixed pipeline only but can also use shaders.
*	Shaders are used to render models and must be compatible with internal structure.
*	GLphongLightingVs and GLphongLightingFs are compatible with this structure and can be used for
*	per pixel model lighting.
*/
class GLPhongRender: public Render
{
protected:
	ShaderComposer vertexShader;
	ShaderComposer fragmentShader;

public:
	GLPhongRender( Context &context, CGprogram vertexShader, CGprogram fragmentShader  /*, unsigned int shadowTexture, unsigned int shadowTextureRes*/ );  /**<  context = informace kam renderovat, vertexShader a fragmentShader = se tridou kompatibilni shadery, shadowTextur =ID textury urcene pro shadow mapping, shadowTextureRes = velikost teto textury */

	void renderPhongModels( vector<Light*> &lights, vector<Model*> &models  );	/**<  vytvori shadow mapu */
	void renderLights( vector<Light*> &lights, const vector< CTriCol*>& lightColors );
	void renderLights( vector<Light*> &lights, const CTriCol* color=NULL );

	//void calculateShadowMapping( vector<PhongLight*> &lights, vector<Model*> &models );	/**<  vlastni render */

	void beginFrame(const Camera<double>& camera);

	
	bool isFragmentShaderValid(void); /**< Returns true if fragment shader can be used.*/
	bool isVertexShaderValid(void);		/**< Returns true if vertex shader can be used.*/
};

#endif