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

#pragma once

#include "glmCoreAPI.h"
#include "glmMemory.h"
#include "glmArray.h"
#include "glmString.h"
#include "glmVector3.h"

#include <glmGolaemCharacterDeclarations.h> // GolaemCharacter declarations

namespace glm
{
    struct VertexInfluence
	{
		unsigned short boneIndex;
		float boneWeight;

		bool operator<(const VertexInfluence &rhs) const
		{
			return boneWeight < rhs.boneWeight;
		}

		static VertexInfluence getNullInfluence()
		{
			VertexInfluence nullInfluence;
			nullInfluence.boneWeight = 0.f;
			nullInfluence.boneIndex = 0;
			return nullInfluence;
		}
	};

    class GLM_CORE_API CharacterSkinMeshesInterface
    {

    public:
        struct GeometryType
        {
            enum Value
            {
                GT_FBX,
                GT_GCG,
                GT_END,
            };
        };

        virtual int getMeshIndex(const glm::GlmString& meshName) = 0;

        virtual int getMeshIndices(const glm::GlmString& meshName, glm::PODArray<int>& meshindices) = 0;

        virtual GeometryType::Value getGeometryType() = 0;

        // info on source meshes
        /**
		* Vertex positions
		*/
        virtual int getOriginalMeshVertexCount(unsigned int transformIndex) const = 0;
        virtual void getOriginalMeshVertex(Vector3& retValue, unsigned int transformIndex, unsigned int vertexIndex) const = 0;
        /**
		* Triangles indices
		*/
        virtual int getOriginalMeshIndexCount(unsigned int meshIndex) const = 0;                     //triangles only
        virtual int getOriginalMeshIndex(unsigned int meshIndex, unsigned int indexIndex) const = 0; //triangles only

        virtual void getVertexInfluences(glm::PODArray<VertexInfluence>& retValue, unsigned int meshIndex, const HierarchicalSkeletonDescription* skeleton) const = 0; //all influences per vertex

        virtual const Vector3& getBBoxMin() const = 0;
        virtual const Vector3& getBBoxMax() const = 0;
    };

} // namespace glm
