/********************************************************************************
*                                                                               *
*   Copyright (C) Golaem S.A.  All Rights Reserved.                             *
*                                                                               *
*   Original code & license:                                                    *
*                                                                               *
*   OpenSteer -- Steering Behaviors for Autonomous Characters                   *
*                                                                               *
*   Copyright (c) 2002-2003, Sony Computer Entertainment America                *
*   Original author: Craig Reynolds <craig_reynolds@playstation.sony.com>       *
*                                                                               *
*   Permission is hereby granted, free of charge, to any person obtaining a     *
*   copy of this software and associated documentation files (the "Software"),  *
*   to deal in the Software without restriction, including without limitation   *
*   the rights to use, copy, modify, merge, publish, distribute, sublicense,    *
*   and/or sell copies of the Software, and to permit persons to whom the       *
*   Software is furnished to do so, subject to the following conditions:        *
*                                                                               *
*   The above copyright notice and this permission notice shall be included in  *
*   all copies or substantial portions of the Software.                         *
*                                                                               *
*   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  *
*   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,    *
*   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL    *
*   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  *
*   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING     *
*   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER         *
*   DEALINGS IN THE SOFTWARE.                                                   *
*                                                                               *
********************************************************************************/

#pragma once

#include "glmSDKAPI.h"
#include "glmCoreDefinitions.h"
#include "glmVector3.h"

namespace glm
{
	class Entity;
	class BoidEntityComponent;

	/**
	* \brief Flocking Perching Support, check if a boid is passing around a perching support
	*
	* \author Golaem <dev@golaem.com>
	*/
	class GLM_SDK_API AbstractFlockPerchingSupport
	{

	public:
		GLM_CLASS_STAT_ID(glm::MemoryStatIds::Simulation)

		float _weight;

		AbstractFlockPerchingSupport() :
			_perchingRayCastDistance(5.f),
			_landingDistance(3.f),
			_takeOffDistance(3.f),
			_landingSpeed(0.f),
			_dynamic(false),
			_deformable(false)
		{ }

		virtual ~AbstractFlockPerchingSupport() {}

		virtual void checkIntersection( Entity& entity, BoidEntityComponent& entityComponent ) = 0;

		// in case this is dynamic
		virtual bool updateIntersection(BoidEntityComponent& /*entityComponent*/) { return false;  }

		virtual bool offsetPerchingPosition(BoidEntityComponent& /*entityComponent*/, float /*offsetPerchingDistance*/) { return false; }

		virtual void deleteActiveSupportData(void* /*activeSupportData*/) {}

		virtual void getPerchingCell(const BoidEntityComponent& /*entityComponent*/, Vector3(&perchingCell)[3]) const { GLM_UNREFERENCED(perchingCell); }

		float _perchingRayCastDistance;
		float _landingDistance;
		float _takeOffDistance;
		float _landingSpeed;

		bool _dynamic;
		bool _deformable;
	};
}
