#pragma once

#include <wrl.h>
#include <d3d12.h>

#include <memory>
#include <vector>

class DrawingContext;
class DirectXShaderProgram;
class DirectXMesh;
class DirectXInterface;

class DirectXMeshPainter
{
public:
    DirectXMeshPainter();

    ID3D12PipelineState* getPipelineState() const;
    ID3D12RootSignature* getRootSignature() const;

    void initializeD3d();

    void setDxInterface(DirectXInterface* dxInterface);

    void updateBuffers(DrawingContext* context);
    void updateCommandList(ID3D12GraphicsCommandList* commandList);
private:
    void initializeShader();
    void createRootSignature();
    void createPipelineStateObject();

    DirectXInterface* mDxInterface{ nullptr };

    std::vector<std::unique_ptr<DirectXMesh> > mDxMeshes;

    Microsoft::WRL::ComPtr<ID3D12RootSignature> mRootSignature;
    Microsoft::WRL::ComPtr<ID3D12PipelineState> mPipelineState;

    std::unique_ptr<DirectXShaderProgram> mShaderProgram;
};