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

#pragma once

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

#include "glmTypes.h"
#include "glmVector3.h"
#include "glmQuaternion.h"

#include <glmGolaemCharacterDeclarations.h> // GolaemCharacter declarations

namespace glm
{
    class GLM_CORE_API BoneDisplayConfigurationV0
    {
        GLM_RTTI("67ff76a6-ebc9-48bb-a621-69ce9dc6a13b", glm::BoneDisplayConfigurationV0, addAttributes);

    public:                            // data
        uint32_t _colorABGR = 8421504; //(127,127,127) grey with 0 alpha; get rgba when casted into uint8_t[4] ( const uint8_t* rgba = reinterpret_cast<const uint8_t*>(&_colorABGR); )
        bool _enabled = true;
        Vector3 _scale = Vector3(1, 1, 1);
        Vector3 _halfExtents = Vector3(0.1f, 0.1f, 0.1f);
        SkeletonDisplayShape::Value _shape = SkeletonDisplayShape::CYLINDER;

        Quaternion _localOrientationOffset = Quaternion(0, 0, 0, 1);
        Vector3 _localPositionOffset = Vector3(0, 0, 0);

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

        BoneDisplayConfigurationV0();

    public:
        void setLocalOffsetFromWordTransforms(const Quaternion& boneLocalOffset, const Vector3& boneWorldPosition, const Quaternion& boneWorldOrientation, const Vector3& shapeWorldPosition, const Quaternion& shapeOrientation);
        void getShapeWordTransformsFromPosture(Vector3& outShapePosition, Quaternion& outShapeOrientation, const Quaternion& boneLocalOffsetsInverse, const Vector3& boneWorldPosition, const Quaternion& boneWorldOrientation) const;

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

        /**
         * \brief Accessor to the attribute type needed for inspection
         */
        int getShapeAsInt() const;
        void setShapeFromInt(int value);
    };
} // namespace glm
