//------------------------------------------------------------------------------------
// irr::scene::IMeshCache wrappers
//------------------------------------------------------------------------------------

extern "C"
{

	void IrrScene_IMeshCache_addMesh(IMeshCache* imc, const c8* name, IAnimatedMesh* mesh)
	{
		if (imc)
			imc->addMesh(path(name),mesh);
	}

	void IrrScene_IMeshCache_removeAnimatedMesh(IMeshCache* imc,IAnimatedMesh* mesh)
	{
		if (imc)
			imc->removeMesh(mesh);
	}

	void IrrScene_IMeshCache_removeMesh(IMeshCache* imc,IMesh* mesh)
	{
		if (imc)
			imc->removeMesh(mesh);
	}

	u32 IrrScene_IMeshCache_getMeshCount(IMeshCache* imc)
	{
		if (imc)
			return imc->getMeshCount();
		else return 0;
	}

	s32 IrrScene_IMeshCache_getAnimatedMeshIndex(IMeshCache* imc,IAnimatedMesh* mesh)
	{
		if (imc)
			return imc->getMeshIndex(mesh);
		else return 0;
	}

	s32 IrrScene_IMeshCache_getMeshIndex(IMeshCache* imc,IMesh* mesh)
	{
		if (imc)
			return imc->getMeshIndex(mesh);
		else return 0;
	}

	IAnimatedMesh* IrrScene_IMeshCache_getMeshByIndex(IMeshCache* imc,u32 index)
	{
		if (imc)
			return imc->getMeshByIndex(index);
		else return 0;
	}

	const c8* IrrScene_IMeshCache_getMeshNameByIdx(IMeshCache* imc,u32 index)
	{
		if (imc)
			return ((stringc)imc->getMeshName(index)).c_str();
		else return 0;
	}

	const c8* IrrScene_IMeshCache_getAnimatedMeshName(IMeshCache* imc,IAnimatedMesh* mesh)
	{
		if (imc)
			return ((stringc)imc->getMeshName(mesh)).c_str();
		else return 0;
	}

	const c8* IrrScene_IMeshCache_getMeshName(IMeshCache* imc,IMesh* mesh)
	{
		if (imc)
			return ((stringc)imc->getMeshName(mesh)).c_str();
		else return 0;
	}
	
	bool IrrScene_IMeshCache_drop(IMeshCache* unk)
	{
		if (unk)
			return unk->drop();
		else return 0;
	}
	
	const c8* IrrScene_IMeshCache_getDebugName(IMeshCache* unk)
	{
		if (unk)
			return unk->getDebugName();
		else return "";
	}
	
	void IrrScene_IMeshCache_grab(IMeshCache* unk)
	{
		if (unk)
			unk->grab();
	}
	
	// do not delete
	IAnimatedMesh* IrrScene_IMeshCache_getMeshByName(IMeshCache* imc, const c8* filename)
	{
		if (imc)
			return imc->getMeshByName(path(filename));
		else return 0;
	}

	bool IrrScene_IMeshCache_renameMeshByIndex(IMeshCache* imc,u32 index, const c8* filename)
	{
		if (imc)
			return imc->renameMesh(index,path(filename));
		else return false;
	}
	
	bool IrrScene_IMeshCache_renameAnimatedMesh(IMeshCache* imc,const IAnimatedMesh* const mesh, const c8* filename)
	{
		if (imc)
			return imc->renameMesh(mesh,path(filename));
		else return false;
	}

	bool IrrScene_IMeshCache_renameMesh(IMeshCache* imc,const IMesh* const mesh, const c8* filename)
	{
		if (imc)
			return imc->renameMesh(mesh,path(filename));
		else return false;
	}

	bool IrrScene_IMeshCache_isMeshLoaded(IMeshCache* imc,const c8* name)
	{
		if (imc)
			return imc->isMeshLoaded(path(name));
		else return false;
	}
	
	void IrrScene_IMeshCache_clear(IMeshCache* imc)
	{
		if (imc)
			imc->clear();
	}

	void IrrScene_IMeshCache_clearUnusedMeshes(IMeshCache* imc)
	{
		if (imc)
			imc->clearUnusedMeshes();
	}
}

