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

#pragma once

#include "glmSDKAPI.h"
#include "glmMotionDefinitions.h"
#include "glmGolaemMotionDeclarations.h"
#include "glmBlindData.h"

namespace glm
{
	struct AnimationType
	{
		enum Value
		{
			UNKNOWN,
			GENERIC,
			SPECIFIC,
			END
		};
	};

	/**
	 * \brief Interface for an animation
	 *
	 * \author dev@golaem.com
	 *
	 */
	class GLM_SDK_API AnimationInterface
	{
	public: //static methods
		GLM_ABSTRACTCLASS_STAT_ID(glm::MemoryStatIds::Simulation)

	public:	//methods
		AnimationInterface(AnimationType::Value animationType)
			: _animationType(animationType)
		{ }
		virtual ~AnimationInterface()	{ _animationType = AnimationType::UNKNOWN; }
		AnimationType::Value getAnimationType() const { return _animationType; }

		//direct data access
		virtual Time getDeltaTime() const = 0;
		virtual int getPosturesCount() const = 0;

		virtual const Array<BlindData>& getBlindDataInfo() const = 0;
		virtual const PODArray<float>& getBlindData(int frameIndex) const = 0;

		virtual const Array<GroundSupportSequence>& getConstraintSequences() const = 0;

		//data processing
		virtual void getTotalDeltaPosition(Vector3& result) const = 0;
		virtual void getTotalNormalizedDeltaPosition(Vector3& result) const = 0;
		virtual void getTotalDeltaOrientation(Quaternion& result) const = 0;
		virtual glm::Angle computeTotalDeltaHeading() const = 0;
		virtual Vector3 getMovingDirectionAtFrame(unsigned int frameIndex) const = 0;
		virtual void computePosturesMovingDirection() = 0;
		virtual Vector3 computeAverageMovingDirection() const = 0;
		virtual void computeAverageMovingDirection(Vector3& result) const = 0;

		virtual bool hasGroundNormal() const = 0;
		virtual Vector3 getGroundNormalAtFrame(unsigned int frameIndex, unsigned int constraintSequenceIndex) const = 0;

		//animation edition
		virtual void computeFootPrintsFullAutomatic(const glm::PODArray<bool>& limbs) = 0;
		virtual bool cropMotion(int newFirstFrame, int newLastFrame) = 0;
		virtual bool editMotion(const EditMotionParameters& parameters) = 0;

	protected:	//data
		AnimationType::Value _animationType;
	};
}
