//------------------------------------------------------------------------------------
// irr::video::ITexture wrappers
//
// you cannot create ITextures directly.  you must use IVideoDriver::addTexture() or
// IVideoDriver::getTexture().  you do not delete these references, you remove them with
// IVideoDriver::removeTexture().
//------------------------------------------------------------------------------------

extern "C" 
{

	void IrrVideo_ITexture_del(ITexture* texture)
	{
		if (texture)
			texture->drop();
	}
	
	void* IrrVideo_ITexture_lock(ITexture* texture, bool readOnly = false, u32 mipmapLevel = 0)
	{
		if (texture)
			return texture->lock(readOnly, mipmapLevel);
		else return 0;
	}
	
	void IrrVideo_ITexture_unlock(ITexture* texture)
	{
		if (texture)
			texture->unlock();
	}
	
	dimension2d<s32>* IrrVideo_ITexture_getOriginalSize(ITexture* texture)
	{
		if (texture)
			return new dimension2d<s32>(texture->getOriginalSize());
		else
			return 0;
	}
	
	dimension2d<s32>* IrrVideo_ITexture_getSize(ITexture* texture)
	{
		if (texture)
			return new dimension2d<s32>(texture->getSize());
		else
			return 0;
	}
	
	s32 IrrVideo_ITexture_getDriverType(ITexture* texture)
	{
		if (texture)
			return texture->getDriverType();
		else
			return 0;
	}
	
	s32 IrrVideo_ITexture_getColorFormat(ITexture* texture)
	{
		if (texture)
			return texture->getColorFormat();
		else
			return 0;
	}
	
	u32 IrrVideo_ITexture_getPitch(ITexture* texture)
	{
		if (texture)
			return texture->getPitch();
		else
			return 0;
	}
	
	void IrrVideo_ITexture_regenerateMipMapLevels(ITexture* texture, void* mipmapData = 0)
	{
		if (texture)
			texture->regenerateMipMapLevels(mipmapData);
	}	
	
	bool IrrVideo_ITexture_hasMipMaps(ITexture* texture)
	{ 
		if (texture)
			return texture->hasMipMaps();
		return false;
	}

	// must delete
	SNamedPath* IrrVideo_ITexture_getName(ITexture* texture)
	{
		if (texture)
			return new SNamedPath(texture->getName());
		else return 0;
	}

	bool IrrVideo_ITexture_isRenderTarget(ITexture* texture)
	{
		if (texture)
			return texture->isRenderTarget();
		else return false;
	}

	bool IrrVideo_ITexture_hasAlpha(ITexture* texture) 
	{
		if (texture)
			return texture->hasAlpha();
		else return false;
	}

	bool IrrVideo_ITexture_drop(ITexture* unk)
	{
		if (unk)
			return unk->drop();
		else return 0;
	}
	
	const c8* IrrVideo_ITexture_getDebugName(ITexture* unk)
	{
		if (unk)
			return unk->getDebugName();
		else return "";
	}
	
	void IrrVideo_ITexture_grab(ITexture* unk)
	{
		if (unk)
			unk->grab();
	}		
}


