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

#pragma once

#include "glmCoreAPI.h"
#include "glmRTTI.h"
#include "glmAssetGroupV1.h"
#include "glmMeshAssetV4.h"
#include "glmGeometryAssetV2.h"
#include "glmShadingGroup.h"
#include "glmRenderingType.h"
#include "glmGenericSpecificConverterMappingV7.h"
#include "glmCharacterUserData.h"
#include "glmShaderAssetV1.h"
#include "glmShaderAttributeV2.h"
#include "glmClothAsset.h"
#include "glmGolaemCharacterBlindDataOverride.h"
#include "glmGolaemCharacterSkeletonOverride.h"
#include "glmGolaemCharacterInterface.h"

namespace glm
{
    struct GolaemCharacterV14;

    struct GLM_CORE_API GolaemCharacterV15 : public GolaemCharacterInterface
    {
        GLM_VIRTUAL_RTTI("ab500887-c019-4d85-9307-b3b9d44efe2a", glm::GolaemCharacterV15, addAttributes);

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

        /// Name of the character
        glm::GlmString _name;
        int _fileVersion;

        glm::PODArray<int> _mainAssetGroups;
        glm::PODArray<int> _mainShaderAttributes;

        glm::Array<AssetGroupV1> _allAssetGroups;
        glm::Array<MeshAssetV4> _meshAssets;

        glm::GlmMap<short, glm::Array<GeometryAssetV2>> _geometryAssetsPerTags;

        glm::Array<ShadingGroupV1> _shadingGroups;

        glm::Array<ShaderAttributeV2> _shaderAttributes;

        glm::Array<ShaderAssetV1> _shaderAssets;

        glm::Array<RenderingTypeV4> _renderingTypes;

        GenericSpecificConverterMappingV7 _converterMapping; // animation data
        CharacterUserDataV0 _characterUserData;              // additional user data

        Array<SkeletonOverrideV0> _skeletonOverrides;
        Array<BlindDataOverrideV0> _blindDataOverrides;

        GolaemCharacterV15();
        ~GolaemCharacterV15();

        /**
		* \brief V14 backwards compatibility
		* \note V15 adds weights to the int shader attribute 
		*/
        void createFromV14(GolaemCharacterV14& characterV14);

        // Accessors
        const GenericSpecificConverterMappingV7& getConverterMapping() const;
        void setConverterMapping(const GenericSpecificConverterMappingV7& mapping);
        const CharacterUserDataV0& getCharacterUserData() const;
        void setCharacterUserData(const CharacterUserDataV0& userData);

    private:
        GLM_DISALLOW_COPY_AND_ASSIGN(GolaemCharacterV15);
        static void addAttributes();
    };
} // namespace glm
