
extern "C" 
{

//------------------------------------------------------------------------------------
// irr::scene::IMeshManipulator wrappers
//------------------------------------------------------------------------------------

	bool IrrScene_IMeshManipulator_drop(IMeshManipulator* unk)
	{
		if (unk)
			return unk->drop();
		else return 0;
	}
	
	const c8* IrrScene_IMeshManipulator_getDebugName(IMeshManipulator* unk)
	{
		if (unk)
			return unk->getDebugName();
		else return "";
	}
	
	void IrrScene_IMeshManipulator_grab(IMeshManipulator* unk)
	{
		if (unk)
			unk->grab();
	}

	// note: you will need to drop the new mesh pointer
	SMesh* IrrScene_IMeshManipulator_createMeshCopy(IMeshManipulator* mm,IMesh* mesh)
	{
		if (mm)
			return mm->createMeshCopy(mesh);
		else return 0;
	}
	
	// note: you will need to drop the new mesh pointer
	IMesh* IrrScene_IMeshManipulator_createMeshWithTangents(IMeshManipulator* mm,IMesh* mesh, bool recalculateNormals=false, bool smooth=false, bool angleWeighted=false, bool recalculateTangents=true)
	{
		if (mm)
			return mm->createMeshWithTangents(mesh, recalculateNormals, smooth, angleWeighted, recalculateTangents);
		else return 0;
	}
	
	IMesh* IrrScene_IMeshManipulator_createMeshUniquePrimitives(IMeshManipulator* mm,IMesh* mesh)
	{
		if (mm)
			return mm->createMeshUniquePrimitives(mesh);
		else return 0;
	}
	
	void IrrScene_IMeshManipulator_flipSurfaces(IMeshManipulator* mm,IMesh* mesh)
	{
		if (mm)
			mm->flipSurfaces(mesh);
	}
	
	s32 IrrScene_IMeshManipulator_getPolyCountFromAnimated(IMeshManipulator* mm,IAnimatedMesh* mesh)
	{
		if (mm)
			return mm->getPolyCount(mesh);
		else return 0;
	}
	
	s32 IrrScene_IMeshManipulator_getPolyCount(IMeshManipulator* mm,IMesh* mesh)
	{
		if (mm)
			return mm->getPolyCount(mesh);
		else return 0;
	}
	
	void IrrScene_IMeshManipulator_makePlanarTextureMapping(IMeshManipulator* mm,IMesh* mesh,f32 resolution=0.001f)
	{
		if (mm)
			mm->makePlanarTextureMapping(mesh,resolution);
	}

	void IrrScene_IMeshManipulator_makePlanarTextureMappingFromBuffer(IMeshManipulator* mm, IMeshBuffer* meshbuffer, f32 resolution=0.001f)
	{
		if (mm)
			mm->makePlanarTextureMapping(meshbuffer, resolution);
	}

	void IrrScene_IMeshManipulator_makePlanarTextureMappingFromBufferWithOffset(IMeshManipulator* mm, IMeshBuffer* buffer, f32 resolutionS, f32 resolutionT, u8 axis, const core::vector3df& offset)
	{
		if (mm)
			mm->makePlanarTextureMapping(buffer, resolutionS, resolutionT, axis, offset);
	}
	
	void IrrScene_IMeshManipulator_recalculateNormals(IMeshManipulator* mm,IMesh* mesh,bool smooth = false, bool angleWeighted = false)
	{
		if (mm)
			mm->recalculateNormals(mesh, smooth, angleWeighted);
	}
	
	void IrrScene_IMeshManipulator_recalculateNormalsMeshBuffer(IMeshManipulator* mm,IMeshBuffer* buffer,bool smooth = false, bool angleWeighted = false)
	{
		if (mm)
			mm->recalculateNormals(buffer, smooth, angleWeighted);
	}
	
	void IrrScene_IMeshManipulator_scaleMesh(IMeshManipulator* mm,IMesh* mesh,vector3df* scale)
	{
		if (mm)
			mm->scaleMesh(mesh,*scale);
	}
	
	void IrrScene_IMeshManipulator_setVertexColorAlpha(IMeshManipulator* mm,IMesh* mesh,s32 alpha)
	{
		if (mm)
			mm->setVertexColorAlpha(mesh,alpha);
	}
	
	void IrrScene_IMeshManipulator_setVertexColors(IMeshManipulator* mm,IMesh* mesh,SColor* color)
	{
		if (mm)
			mm->setVertexColors(mesh,*color);
	}

	void IrrScene_IMeshManipulator_transformMesh(IMeshManipulator* mm,IMesh* mesh, const core::matrix4& m)
	{
		if (mm)
			mm->transformMesh(mesh,m);
	}
	
	IAnimatedMesh* IrrScene_IMeshManipulator_createAnimatedMesh(IMeshManipulator* mm,scene::IMesh* mesh,
		scene::E_ANIMATED_MESH_TYPE type = scene::EAMT_UNKNOWN)
	{
		if (mm)
			return mm->createAnimatedMesh(mesh,type);
		else return 0;
	}

	// must delete
	IMesh* IrrScene_IMeshManipulator_createMeshWith2TCoords(IMeshManipulator* mm,IMesh* mesh)
	{
		if (mm)
			return mm->createMeshWith2TCoords(mesh);
		else return 0;
	}
	
	// must delete
	IMesh* IrrScene_IMeshManipulator_createMeshWelded(IMeshManipulator* mm,IMesh* mesh, f32 tolerance = ROUNDING_ERROR_f32)
	{
		if (mm)
			return mm->createMeshWelded(mesh, tolerance);
		else return 0;
	}

	void IrrScene_IMeshManipulator_scale(IMeshManipulator* mm, IMesh* mesh, const core::vector3df* factor)
	{
		if (mm)
			mm->scale(mesh, *factor);
	}

	void IrrScene_IMeshManipulator_scaleMeshBuffer(IMeshManipulator* mm, IMeshBuffer* buffer, const core::vector3df* factor)
	{
		if (mm)
			mm->scale(buffer, *factor);
	}

	void IrrScene_IMeshManipulator_scaleTCoords(IMeshManipulator* mm, scene::IMesh* mesh, const core::vector2df* factor, u32 level = 1)
	{
		if (mm)
			mm->scaleTCoords(mesh, *factor, level);
	}

	void IrrScene_IMeshManipulator_scaleTCoordsMeshBuffer(IMeshManipulator* mm, scene::IMeshBuffer* buffer, const core::vector2df* factor, u32 level=1) 
	{
		if (mm)
			mm->scaleTCoords(buffer, *factor, level);
	}

	void IrrScene_IMeshManipulator_transform(IMeshManipulator* mm, IMesh* mesh, const core::matrix4* m)
	{
		if (mm)
			mm->transform(mesh, *m);
	}

	void IrrScene_IMeshManipulator_transformMeshBuffer(IMeshManipulator* mm, IMeshBuffer* buffer, const core::matrix4* m)
	{
		if (mm)
			mm->transform(buffer, *m);
	}

	IMesh* IrrScene_IMeshManipulator_createMeshWith1TCoords(IMeshManipulator* mm, IMesh* mesh) 
	{
		if (mm)
			return mm->createMeshWith1TCoords(mesh);
		else return 0;
	}

	void IrrScene_IMeshManipulator_recalculateTangents(IMeshManipulator* mm, IMesh* mesh, bool recalculateNormals=false, bool smooth=false, bool angleWeighted=false)
	{
		if (mm)
			mm->recalculateTangents(mesh, recalculateNormals, smooth, angleWeighted);
	}

	bool IrrScene_IMeshManipulator_applyToMeshBuffer(IMeshManipulator* mm, BMXIVertexManipulator* manipulator, IMeshBuffer* buffer, bool boundingBoxUpdate = false)
	{
		if (mm) {
			return mm->apply(*manipulator, buffer, boundingBoxUpdate);
		}
	}

	bool IrrScene_IMeshManipulator_applyToMesh(IMeshManipulator* mm, BMXIVertexManipulator* manipulator, IMesh* mesh, bool boundingBoxUpdate = false)
	{
		if (mm) {
			return mm->apply(*manipulator, mesh, boundingBoxUpdate);
		}
	}
}
