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

#pragma once

#include "glmSDKAPI.h"
#include "glmMotionDefinitions.h"

namespace glm
{
    class GenericSpecificConverter;

    /**
	* \brief GL3D AbstractVisualizationContext implementation
	*
	* \author Golaem <dev@golaem.com>
	*/
    class GLM_SDK_API SkeletonRenderingCache
    {
    public:
        GLM_CLASS_STAT_ID(glm::MemoryStatIds::GolaemShared);

        struct GLM_SDK_API BoneRenderingCache
        {
            SkeletonDisplayShape::Value _shape = SkeletonDisplayShape::SPHERE;
            Vector3 _halfExtents = Vector3(1, 1, 1);
            Vector3 _scale = Vector3(1, 1, 1);
            Vector3 _positionOffset = Vector3(0, 0, 0);
            Quaternion _orientationOffset = Quaternion(0, 0, 0, 1);
            int _boneIndex = -1;           // const HierarchicalBone *_bone;
            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); )

            BoneRenderingCache();

            BoneRenderingCache(
                SkeletonDisplayShape::Value shape,
                const Vector3& boneExtents,
                const Vector3& scale,
                const Vector3& positionOffset,
                const Quaternion& orientationOffset,
                int boneIndex,
                uint32_t colorABGR);
        };

    public:
        float _skeletonRadius;
        // index 0 = All
        // 1 = used by spines + limbs
        // 2 = Mapped + rigidShape
		glm::Array<glm::Array<BoneRenderingCache> > _boneCacheValues;
		glm::GlmMap<int, int>	_physicsOverrideAssetIndexToBoneRenderingCacheIndex;

    public:
        SkeletonRenderingCache(GenericSpecificConverter* converter);
        ~SkeletonRenderingCache();
    };
} // namespace glm
