#pragma once

/* Path to the engine */
#include "SalmonEngineWindows.h"
#include "gameMap.h"

using namespace SE;

//Application class
class TMyApplication : public SE::TApplication
{
	/*
	TLiteModel* lm;
	TSimpleLandClass* TestLand;
	glmat3 LiteModelRotateMatrix;
	glmat3 LiteModelDeltaRotateMatrix;
	cardinal LiteModelUpdateTimer;
	*/
	TGameMap GameMap;

	bool MouseRightButtonPressed;
	//Rotate camera on mouse right button pressed

	bool MouseLeftButtonPressed;

	int MouseX0, MouseY0;
	//Mouse pos caught on right button click

	int view = 0;

	vec3 lightPos;

	bool day = false;

	float WaterTimer;

	void DrawSceneWithoutWater();

	void DrawToCubemap();

	void DrawToShadowMap();

	void DrawWaterSurface();

	void DrawCubemapFixed();
	void DrawCubemap();
	void DrawCubemapDay();
	void DrawCubemapNight();

	void DrawFrameFullScreen();

	cardinal cubemapTexture;
	cardinal cubemapTextureDay;
	cardinal cubemapTextureNight;
	VertexDataStruct cubemapVertexDataStruct;
	VertexDataStruct waterVertexDataStruct;
	VertexDataStruct frameVertexDataStruct;
public:

	//Constructor
	TMyApplication() : MouseRightButtonPressed(false), MouseLeftButtonPressed(false), WaterTimer(0) {
		Width = 1920;
		Height = 1080;
	}

	virtual void InnerInit();
	//What to do on init

	virtual void InnerDeinit();
	//What to do on deinit

	virtual void InnerDraw();
	//What to do on draw 

	virtual void InnerUpdate(cardinal timer);
	//What to do on update. timer means how many ms passed since last update

	virtual void UpdateQuick();
	//To process input - this method is called more frequently than Update() 

	virtual void OnMouseMove(TMouseState& mouseState);
	//To do on mouse move (with or without pressed buttons)

	virtual void OnMouseDown(TMouseState& mouseState);
	//To do on mouse move (with or without pressed buttons)

	virtual void OnMouseUp(TMouseState& mouseState);
	//To do on mouse move (with or without pressed buttons)

	virtual void OnMouseWheel(short int delta);
	//To do on mouse wheel move
};