//------------------------------------------------------------------------------------
// irr::IShaderConstantSetCallBack wrappers
//------------------------------------------------------------------------------------

class BMXIShaderConstantSetCallBack : public IShaderConstantSetCallBack
{
public:

	BMXBinder binder;

	void (*BMXIShaderConstantSetCallBack_OnSetConstants)(s32 binding, IMaterialRendererServices* services,s32 userData);
	void (*BMXIShaderConstantSetCallBack_OnSetMaterial)(s32 binding, const SMaterial* material);

	BMXBinder* getBinder()
	{
		return &binder;
	}

	BMXIShaderConstantSetCallBack() : IShaderConstantSetCallBack()
	{
		BMXIShaderConstantSetCallBack_OnSetConstants=0;
	}
	
	void bindOnSetConstants(void (*bind_OnSetConstants)(s32 binding,IMaterialRendererServices* services,s32 userData))
	{
		BMXIShaderConstantSetCallBack_OnSetConstants=bind_OnSetConstants;
	}

	virtual void OnSetMaterial(const SMaterial& material) 
	{ 
		if (BMXIShaderConstantSetCallBack_OnSetMaterial) 
			BMXIShaderConstantSetCallBack_OnSetMaterial(binder.binding, &material);
	}

	virtual void OnSetConstants(IMaterialRendererServices* services,s32 userData)
	{
		if (BMXIShaderConstantSetCallBack_OnSetConstants)
			BMXIShaderConstantSetCallBack_OnSetConstants(binder.binding,services,userData);
	}	
};

extern "C" 
{
	BMXIShaderConstantSetCallBack* IrrVideo_BMXIShaderConstantSetCallBack_new()
	{
		return new BMXIShaderConstantSetCallBack();
	}
	
	BMXBinder* IrrVideo_BMXIShaderConstantSetCallBack_getBinder(BMXIShaderConstantSetCallBack* cb)
	{
		if (cb)
			return cb->getBinder();
		else return 0;
	}
	
	void IrrVideo_BMXIShaderConstantSetCallBack_bindOnSetConstants(BMXIShaderConstantSetCallBack* cb,void (*bind_OnSetConstants)(s32 binding,IMaterialRendererServices* services,s32 userData))
	{
		if (cb)
			cb->bindOnSetConstants(bind_OnSetConstants);
	}

	void IrrVideo_BMXIShaderConstantSetCallBack_bindOnSetMaterial(BMXIShaderConstantSetCallBack* cb,void (*bind_OnSetMaterial)(s32 binding, const SMaterial* material))
	{
		if (cb)
			cb->BMXIShaderConstantSetCallBack_OnSetMaterial = bind_OnSetMaterial;
	}
	
	void IrrVideo_BMXIShaderConstantSetCallBack_del(BMXIShaderConstantSetCallBack* del)
	{
		if (del)
			delete del;
			
		del=0;
	}

	bool IrrScene_IShaderConstantSetCallBack_drop(IShaderConstantSetCallBack* unk)
	{
		if (unk)
			return unk->drop();
		else return 0;
	}
	
	const c8* IrrScene_IShaderConstantSetCallBack_getDebugName(IShaderConstantSetCallBack* unk)
	{
		if (unk)
			return unk->getDebugName();
		else return "";
	}
	
	void IrrScene_IShaderConstantSetCallBack_grab(IShaderConstantSetCallBack* unk)
	{
		if (unk)
			unk->grab();
	}
	
}
