/***************************************************************************
*                                                                          *
*  Copyright (C) Golaem S.A.  All Rights Reserved.                         *
*                                                                          *
***************************************************************************/

#pragma once

#include "glmAbstractGround.h"
#include "glmPlane3.h"

namespace glm
{
	/**
	* \brief Ground class used when no ground is defined.
	*
	* Concretely, the absence of ground means that:
	* \li Each position is its own ground projection, the retreaved groundPosition will be the same as the input position;
	* \li The normal is the unit z vector;
	* \li Only one cell, having 0 as its identifier is defined.
	*
	* \ingroup ground
	*
	* \author Golaem <dev@golaem.com>
	*/
	class GLM_SDK_API NoGround : public AbstractGround
	{
	public:

		GLM_CLASS_STAT_ID( glm::MemoryStatIds::GolaemShared)

		/**
		* \name Construction/Destruction
		*/
		//@{
		NoGround();
		virtual ~NoGround();
		//@}

		/**
		* \name Projection retrieval
		*/
		//@{
		virtual bool computeProjection(const Vector3& position, const Vector3& upVector, Vector3& groundPosition, Vector3& groundNormal, float height, GroundCellId& groundCellId, int genericBoneIndex, const void * userPtr) const override;
		//@}

		/**
		* \name init/update/finish
		*/
		//@{
		virtual void init();
		virtual void update(Time dt);
		virtual void finish();
		//@}

		/**
		* \name Debug geometry
		*/
		//@{
		void computeGeometry(glm::Array<Triangle3>& triangles, glm::Array<Segment3>& normals, const Matrix4& callerMatrixInverse) const;
		//@}

		virtual bool isNoGround() const { return true; }

	private:

		GLM_DISALLOW_COPY_AND_ASSIGN( NoGround ) ;
	};
}

