//------------------------------------------------------------------------------------
// irr::scene::SMesh wrappers (parent is IMesh)
//------------------------------------------------------------------------------------

extern "C" 
{

	SMesh* IrrScene_SMesh_new()
	{
		return new SMesh();
	}
	
	void IrrScene_SMesh_del(SMesh* mesh)
	{
		if (mesh)
			mesh->drop();
			
		mesh=0;
	}
	
	// do not delete this pointer
	aabbox3d<f32>* IrrScene_SMesh_getBoundingBox(SMesh* mesh)
	{
		if (mesh)
			return new aabbox3d<f32>(mesh->getBoundingBox());
		else return 0;
	}
	
	void IrrScene_SMesh_addMeshBuffer(SMesh* mesh,IMeshBuffer *buf)
	{
		if (mesh)
			mesh->addMeshBuffer(buf);
	}
	
	// do note delete this pointer
	IMeshBuffer* IrrScene_SMesh_getMeshBuffer(SMesh* mesh,u32 nr)
	{
		if (mesh)
			mesh->getMeshBuffer(nr);
		else return 0;
	}
	
	u32 IrrScene_SMesh_getMeshBufferCount(SMesh* mesh)
	{
		if (mesh)
			return mesh->getMeshBufferCount();
		else return 0;
	}
	
	void IrrScene_SMesh_recalculateBoundingBox(SMesh* mesh)
	{
		if (mesh)
			mesh->recalculateBoundingBox();
	}
	
	void IrrScene_SMesh_setMaterialFlag(SMesh* mesh,E_MATERIAL_FLAG flag,bool newvalue)
	{
		if (mesh)
			mesh->setMaterialFlag(flag,newvalue);
	}
	
	void IrrScene_SMesh_setBoundingBox(SMesh* mesh,const core::aabbox3df& box)
	{
		if (mesh)
			mesh->setBoundingBox(box);
	}

	IMeshBuffer* IrrScene_SMesh_getMeshBufferFromMaterial(SMesh* mesh,const video::SMaterial & material)
	{
		if (mesh)
			return mesh->getMeshBuffer(material);
		else return 0;
	}
}
