#include "CustomDX11API.h"

#include <Shader.h>

#include "CustomUIDX11PixelShader.h"
#include "CustomUIDX11VertexShader.h"

using namespace Framework;

CustomDX11API::CustomDX11API()
    : DirectX11(),
      vertexShaderLightBufferIndex(-1)
{}

Framework::DX11VertexShader* CustomDX11API::initializeVertexShader(
    unsigned char* byteCode, int size)
{
    DX11VertexShader* shader = DirectX11::initializeVertexShader(
        (unsigned char*)CustomUIDX11VertexShader,
        sizeof(CustomUIDX11VertexShader));
    vertexShaderLightBufferIndex = shader->getFirstUninitializedBufferIndex();
    shader->erstelleConstBuffer(4, vertexShaderLightBufferIndex);
    shader->erstelleConstBuffer(4 * 24, vertexShaderLightBufferIndex + 1);
    int count = 0;
    shader->füllConstBuffer((char*)&count, vertexShaderLightBufferIndex, 4);
    return shader;
}

Framework::DX11PixelShader* CustomDX11API::initializePixelShader(
    unsigned char* byteCode, int size)
{
    DX11PixelShader* shader = DirectX11::initializePixelShader(
        (unsigned char*)CustomUIDX11PixelShader,
        sizeof(CustomUIDX11PixelShader));
    return shader;
}

int CustomDX11API::getVertexShaderLightBufferIndex() const
{
    return vertexShaderLightBufferIndex;
}