//------------------------------------------------------------------------------------
// irr::scene::IMeshLoader wrappers
//------------------------------------------------------------------------------------

class BMXIMeshLoader : public IMeshLoader
{
public:

	BMXBinder binder;

	IAnimatedMesh* (*BMXIMeshLoader_createMesh)(s32 binding,IReadFile *file);
	bool (*BMXIMeshLoader_isALoadableFileExtension)(s32 binding,const c8 *fileName);

	BMXBinder* getBinder()
	{
		return &binder;
	}

	BMXIMeshLoader() : IMeshLoader()
	{
		BMXIMeshLoader_createMesh=0;
		BMXIMeshLoader_isALoadableFileExtension=0;
	}
	
	IAnimatedMesh* createMesh(IReadFile* file)
	{
		if (BMXIMeshLoader_createMesh)
			return BMXIMeshLoader_createMesh(binder.binding,file);
		else return 0;
	}

	bool isALoadableFileExtension(const io::path& filename) const 
	{
		if (BMXIMeshLoader_isALoadableFileExtension)
			return BMXIMeshLoader_isALoadableFileExtension(binder.binding, filename.c_str());
		else return false;
	}
};

extern "C" BMXBinder* IrrScene_BMXIMeshLoader_getBinder(BMXIMeshLoader* sa)
{
	if (sa)
		return sa->getBinder();
	else return 0;
}

extern "C" BMXIMeshLoader* IrrScene_BMXIMeshLoader_new()
{
	return new BMXIMeshLoader();
}

extern "C" void IrrScene_BMXIMeshLoader_bindCreateMesh(BMXIMeshLoader* sa,IAnimatedMesh* (*bind_createMesh)(s32 binding,IReadFile* file))
{
	if (sa)
		sa->BMXIMeshLoader_createMesh=bind_createMesh;
}

extern "C" void IrrScene_BMXIMeshLoader_bindIsALoadableFileExtension(BMXIMeshLoader* sa, bool (*bind_isALoadableFileExtension)(s32 binding,const c8* filename))
{
	if (sa)
		sa->BMXIMeshLoader_isALoadableFileExtension=bind_isALoadableFileExtension;
}


