//********************************************************************
// Ninfa3D Engine 
// copyright 2008-2009
// By Viz_Fuerte
// VC: 9.0
// Sprite
//********************************************************************

/*--------------------------------------------------------------------
Includos*/

	#include "..\..\Header Files\Ninfa3D.h"

/*--------------------------------------------------------------------
Variables externas*/

	extern IrrlichtDevice* device;
	extern IVideoDriver* driver;
	extern ISceneManager* SceneManager;

/*--------------------------------------------------------------------
Declaracion global de funciones*/

extern "C"
{

	/*====================================================================
	Carga una imagen para utilizarla como sprite*/

	DLL_EXPORT void* DLL_APIENTRY LoadSprite(const char* File)
	{
		IBillboardSceneNode* bill = SceneManager->addBillboardSceneNode();
		bill->setMaterialTexture(0,driver->getTexture(File));
		bill->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
		bill->setMaterialFlag(EMF_LIGHTING,false);
		bill->setMaterialFlag(EMF_TRILINEAR_FILTER,true);
		bill->setMaterialFlag(EMF_ANISOTROPIC_FILTER,true);

		return (void*)bill;
	}

	/*====================================================================
	Cambia el tamaņo del sprite*/

	DLL_EXPORT void DLL_APIENTRY ScaleSprite(IBillboardSceneNode* bill,float SX,float SY)
	{
		bill->setSize(dimension2d<f32>(SX,SY));
	}

	/*====================================================================
	Cambia el color del sprite*/

	DLL_EXPORT void DLL_APIENTRY SpriteColor(IBillboardSceneNode* bill,unsigned int R,unsigned int G,unsigned int B)
	{
		bill->setColor(SColor(255,R,G,B));
	}

}