#pragma once

#include <DXBuffer.h>
#include <GraphicsApi.h>
#include <Model3D.h>
#include <Textur.h>

class FactoryCraftModel : public Framework::Model3D
{
private:
    Framework::DXBuffer* vertexLightBuffer;
    __int64* lightBuffer;
    int vertexLightBufferCount;
    bool visible;
    float destroyedState;
    Framework::Textur* breakTextur;
    bool effectAlpha;

protected:
    void beforeRender(Framework::GraphicsApi* api,
        Framework::Shader* zVertexShader,
        Framework::Shader* zPixelShader) override;
    void afterRender(Framework::GraphicsApi* api,
        Framework::Shader* zVertexShader,
        Framework::Shader* zPixelShader) override;

public:
    FactoryCraftModel();
    ~FactoryCraftModel();
    void setVertexLightBuffer(__int64* data, int vertexCount);
    __int64* zLightBuffer();
    void copyLightToGPU();
    void setVisible(bool visible);
    void setDestroyedState(float percentage);
    void setUseEffectAlpha(bool useAlpha);
    bool needRenderPolygon(int index) override;
    Framework::Textur* zEffectTextur() override;
    float getEffectPercentage() override;
};