#pragma once

#include "BaseEffect.h"
#include <array>

enum class TechniqueType {
    Point = 0,
    Linear = 1,
    Anisotropic = 2
};


class Effect: public BaseEffect {
public:
    Effect(ID3D11Device *devicePtr, const std::wstring &filePath);

    virtual ~Effect() override;

    void SetWorldMatrix(const dae::Matrix &world) const override;

    void SetCameraPos(const dae::Vector3 &pos) const override;

    void SetMaterial(Material *material);

    void ToggleNormals() override;

    void NextSamplingState() override;

private:

    void InitSamplers(ID3D11Device* devicePtr);

    ID3DX11EffectMatrixVariable *m_MatWorldVariablePtr{};

    ID3DX11EffectShaderResourceVariable *m_DiffuseMapVariablePtr{};
    ID3DX11EffectShaderResourceVariable *m_NormalMapVariablePtr{};
    ID3DX11EffectShaderResourceVariable *m_SpecularMapVariablePtr{};
    ID3DX11EffectShaderResourceVariable *m_GlossMapVariablePtr{};

    ID3DX11EffectVectorVariable *m_CameraPosVariablePtr{};
    ID3DX11EffectVectorVariable *m_LightPosVariablePtr{};
    ID3DX11EffectVectorVariable *m_LightColorVariablePtr{};

    ID3DX11EffectScalarVariable *m_UseNormalMapVariablePtr{};

    ID3DX11EffectSamplerVariable *m_SamplerVariablePtr{};

    TechniqueType m_TechniqueType{TechniqueType::Linear};

    std::array<ID3D11SamplerState*, 3> m_SamplerStates{};

    bool m_UseNormalMap{true};
};
