#ifndef SKY_BOX_H
#define SKY_BOX_H


#include "./renderer/Render.h"
#include "./math/Mathematics.h"
#include "./texture/TextureManager.h"
#include "./configurator/CALreader.h"
#include <cassert>

using namespace GEOMETRY;
using namespace ANALYTICAL_GEOMETRY;

namespace SKYBOX
{

bool getSkyBoxTextures( const calSpace::SkyboxCAL &skybox, const TextureManager &textureManager, unsigned int dstSkyBoxTextures[6] );

///Auxiliary Skybox structure for textures.
struct SkyBox
{
	unsigned int textures[6];
};

enum CubeSide 
{
	FRONT, RIGHT, BACK, LEFT, BOTTOM, TOP
};

///Basic sky interface.
class Sky
{
public:

	virtual void simulate( float dt ) =0;
	virtual void render( Render &render ) =0;

	Sky(void) {};
	Sky( const Sky& ); //undefined
	Sky& operator=( const Sky& ); //undefined
};

///Standard skybox, which consist of 6 cube sides with textures.
class StandardSkyBox : public Sky
{
public:
	SkyBox skyBoxTex;
	float skyboxSize;

	virtual void simulate( float dt );
	virtual void render( Render &render );
	StandardSkyBox(void);
};

///Standard skyplane, which consist of 1 plane with texture.
class StandardSkyPlane : public Sky
{
public:
	unsigned int tex;
	float size;

	virtual void simulate( float dt );
	virtual void render( Render &render );
	StandardSkyPlane(void);
};

///Advanced skyplane, which consist of 1 plane with moving texture.
class CloudySkyPlane : public Sky
{
public:
	unsigned int skyTexture;
	Point_3<float> skyRegion[4];
	float offsetDir[2];				// texture coord offset
	float color[4];

	float centerTexCoord[2];
	float texCoordSize[2];


	virtual void simulate( float dt );
	virtual void render( Render &render );

	CloudySkyPlane(void);
	~CloudySkyPlane(void) {};
};



}
#endif