/*
 * This source file is part of KEOS (Free 3D Engine)
 * For the latest info, see http://www.keosengine.org/
 * E-mails : thierry.vouriot@keosengine.org, yeri@keosengine.org
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA 02111-1307, USA, or go to
 * http://www.gnu.org/copyleft/lesser.txt.
 *
 */

#include "Keos.h"
using namespace Keos;

//-----------------------------------------------------------------------
/** Display a model with some graphic effects using CG shaders.
 */
class CCgShaders : public IRenderApp
{
public:
	
	void Init(void) ;
    void Render(void);
	void Update(void);
    void Release(void);
   
	//! Load a model and a texture
    void Load(const String& Filename, const String& Filename2);
  
	//! Load a model
    void LoadModel(const String& Filename);
  
	//! Load a texture
    void LoadTexture(const String& Filename);
   
    //! Change current shaders
    String NextShaders();

    //! Update the parameters of current shaders
    void UpdateShadersParams();

private:

    //! View matrix 2D
    CMatrix4 m_MatView2D;
    //! View Matrix 3D
    CMatrix4 m_MatView3D;
    //! Projection matrix 2D
    CMatrix4 m_MatProj2D;
    //! Projection matrix 3D
    CMatrix4 m_MatProj3D;

	//! Camera position
    TVector3F m_CameraPos;
    //! Light direction
	TVector3F m_LightDir;
    //! Rotation matrix
    CMatrix4 m_Rotation;
	CMatrix4 m_Rotation2;
    //! Translation matrix
	CMatrix4 m_Translation;

    //! Graphic string which display FPS informations
    CGraphicString*  m_pFPS;
	//! Graphic string which display model filename and texture filename
	CGraphicString*  m_pGSModel;
	//! Model filename
	String			 m_strModel;
	//! Texture filename
	String			 m_strTexture;

	//! Model
    TModelPtr      m_Model;      

    //! Vertex shader
    CShader        m_VertexShader;
    //! Pixel shader
    CShader        m_PixelShader; 
    //! Index of the current shaders
    uint           m_nShaderIndex;

    //! Array with the names of shaders
    static const String ms_Shaders[];   
};
