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

#pragma once

#include "glmCoreAPI.h"
#include "glmRTTI.h"

#include "glmGenericSpecificConverterBone.h"
#include "glmBonePhysicConfiguration.h"
#include "glmEffectorMirrorSource.h"
#include "glmBlendShapeGroupV0.h"

namespace glm
{
    struct GenericSpecificConverterBoneV1;
    class HierarchicalSkeletonDescriptionV1;
    struct GenericSpecificConverterMappingV4;

    struct GLM_CORE_API GenericSpecificConverterMappingV5
    {
        GLM_RTTI("22d79c1d-5c0f-4bc0-8ecc-5fbfc1a488dc", glm::GenericSpecificConverterMappingV5, addAttributes)

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

        GenericSpecificConverterMappingV5();
        ~GenericSpecificConverterMappingV5();

        /**
		* \brief V4 backwards compatibility
		*/
        void createFromV4(GenericSpecificConverterMappingV4& mappingV4);

        //************************************************************
        //! @name Serialized data
        //************************************************************
        //@{
        HierarchicalSkeletonDescriptionV1* _skeletonDescription;

        int _pelvisBoneIndex;
        glm::Array<GenericSpecificConverterBoneV1> _spineBones;
        glm::Array<GenericSpecificConverterBoneV1> _limbBones;
        glm::Array<GenericSpecificConverterBoneV1> _effectorBones;

        glm::Array<glm::GlmString> _spineBoneNames;
        glm::Array<glm::GlmString> _limbBoneNames;
        glm::Array<glm::GlmString> _effectorBoneNames;

        glm::PODArray<int> _ikExcludedBones;

        Vector3 _upAxis;
        Vector3 _frontAxis;

        glm::Array<BonePhysicConfigurationV1> _boneConfigurations;
        glm::PODArray<int> _channelMirrorSources;
        glm::Array<EffectorMirrorSourceV0> _effectorMirrorSources;
        glm::PODArray<float> _groundHeightArray;

        glm::Array<BlendShapeGroupV0> _blendShapeGroups;

        glm::PODArray<float> _squashStretchWeightsArray;
        glm::PODArray<int> _bonesSnsScaleModes; //int because XML serialization does not support char (only 6bits are needed here)
        glm::PODArray<bool> _cacheAllowed;
        //@}

    private:
        GLM_DISALLOW_COPY_AND_ASSIGN(GenericSpecificConverterMappingV5);

        /**
		* \brief register the inspectable attributes to the class RTTI
		*/
        static void addAttributes();

        void finish();
        void clearMappingPart();
    };

} // namespace glm
