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

#pragma once

#include "glmSDKAPI.h"
#include "glmGenericBone.h"
#include <glmGolaemMotionDeclarations.h> // GolaemMotion declarations

namespace glm
{
	struct GLM_SDK_API GenericSkeletonV0
	{
		GLM_RTTI( "d4fa59ee-6998-4a0b-91ab-c98e18a79379", glm::GenericSkeletonV0, addAttributes )

	public:

		GLM_CLASS_STAT_ID( glm::MemoryStatIds::Simulation)

		GenericSkeletonV0();
		~GenericSkeletonV0();

		void finish();

		//************************************************************
		// Bones
		//************************************************************
		//@{
		GenericBone* _rootBone;
		int _nbSpineBones;	//int for serialization purposes... should be size_t
		int _nbLimbBones;
		int _nbEffectorBones;
		glm::Array<GenericBone> _bones;
		glm::PODArray<GenericBone*> _parenting;
		bool _computeBonesChildren;
		//@}

		//************************************************************
		// Additional data
		//************************************************************
		//@{
		//int _locationArraysSize;	//!< is _nbLimbBones/2
		glm::PODArray<int> _limbCoronalLocations;	//!< an array which size is _locationArraysSize. The value at index i is the coronal location of the generic bone 1+_nbSpineBones+(i*2)
		glm::PODArray<int> _limbTransverseLocations;	//!< an array which size is _locationArraysSize. The value at index i is the coronal location of the generic bone 1+_nbSpineBones+(i*2)
		glm::PODArray<int> _limbSagittalLocations;	//!< an array which size is _locationArraysSize. The value at index i is the coronal location of the generic bone 1+_nbSpineBones+(i*2)

		glm::Array<glm::GlmString> _channelNames;

		glm::PODArray<int> _effectorNamesStartIndex;	//index in _effectorNames for the effectors of each channel
		glm::PODArray<int> _effectorNamesCount;		//count of effectors names for each channel
		glm::Array<glm::GlmString> _effectorNames;

		float _rootHeight;
		//@}

		//************************************************************
		// Cached bones positions and orientations
		//************************************************************
		//@{
		glm::Array<Vector3> _boneWorldPositions;
		glm::Array<Vector3> _EOBWorldPositions;
		glm::Array<Quaternion> _boneWorldOrientations;
		glm::Array<Quaternion> _EOBWorldOrientations;
		//@}
	private:

		static void addAttributes() ;
	};
}

