/******************************************************************************
*******************************************************************************

	Bubble Fight EX
	relminator
	http://rel.betterwebber.com


	Singleton Fx3D class


*******************************************************************************
******************************************************************************/

#include <nds.h>
#include <math.h>
#include <gl2d.h>

#include "VertexBuffer.h"
#include "SuperShape.h"

#include "cearn_atan.h"

#ifndef FX3D_H
#define FX3D_H

#define MAX_SHAPES 4
#define MAX_PARTS 256

class Fx3D {

	static Fx3D* ms_instance;

public:
	static Fx3D* Instance();
	static void Release();

	//--------------------------------------
	//	
	//--------------------------------------
	int LoadAscaris( GL_TEXTURE_TYPE_ENUM type,
					  int sizeX,
					  int sizeY,
					  int param,
					  const uint8 *texture,
					  int Palette
				    );
	void ReloadAscarisTexture( GL_TEXTURE_TYPE_ENUM type,
							   int TextureID,
							   int Palette
							 );
	void DrawAscaris( int Palette = 0 );
	void DrawAscaris2( int Palette = 0 );
	
	//--------------------------------------
	//	
	//--------------------------------------
	void LoadShapes( GL_TEXTURE_TYPE_ENUM type,
					 int TextureID,
					 int Palette
				   );
					
	void InitShapes();
	
	void UpdateShapes();
	
	void DrawShapes( int Palette = 0 );
	
	//--------------------------------------
	//	
	//--------------------------------------
	int LoadGrid( GL_TEXTURE_TYPE_ENUM type,
				   int sizeX,
				   int sizeY,
				   int param,
				   const uint8 *texture,
				   int Palette
				 );
	void DrawGrid( int Palette = 0 );
	void ReloadGridTexture( GL_TEXTURE_TYPE_ENUM type,
							   int TextureID,
							   int Palette
							 );
	
	//--------------------------------------
	//	
	//--------------------------------------
	void InitStars();
	void UpdateStars();
	void DrawParts( int Palette = 0 );
	
private:
	Fx3D();
	~Fx3D();
	
	VertexBuffer* Ascaris;
	VertexBuffer* Grid;
	
	SuperShape Shapes[MAX_SHAPES];
	
	Vector3df32 Parts[MAX_PARTS];
	
};

#endif // FX3D_H
