//
// Created by Bram on 20/12/2024.
//

#ifndef GP1_DIRECTX_BASEEFFECT_H
#define GP1_DIRECTX_BASEEFFECT_H

#include <d3d11.h>
#include <d3dx11effect.h>

#include "../Material.h"
#include "../Math/Matrix.h"

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

    virtual ~BaseEffect();

    ID3DX11Effect* GetEffectPtr() const { return m_EffectPtr; }

    ID3DX11EffectTechnique* GetTechniquePtr() const { return m_TechniquePtr; }

    void SetWorldViewProjMatrix(const dae::Matrix& matrix);

    virtual void NextSamplingState();

    virtual void SetCameraPos(const dae::Vector3 &vector3) const;

    virtual void SetMaterial(Material *material);

    virtual void SetWorldMatrix(const dae::Matrix& matrix) const;

    virtual void ToggleNormals();

protected:
    ID3DX11Effect* m_EffectPtr{nullptr};
    ID3DX11EffectTechnique* m_TechniquePtr{};

private:
    ID3DX11EffectMatrixVariable* m_MatWorldViewProjVariablePtr{};

    static ID3DX11Effect* LoadEffect(ID3D11Device* devicePtr, const std::wstring& filePath);
};


#endif //GP1_DIRECTX_BASEEFFECT_H
