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

#include "FireEffect.h"

#include <iostream>

FireEffect::FireEffect(ID3D11Device *devicePtr, const std::wstring &filePath) : BaseEffect(devicePtr, filePath) {
    m_DiffuseMapVariablePtr = m_EffectPtr->GetVariableByName("gDiffuseMap")->AsShaderResource();
    if (!m_DiffuseMapVariablePtr->IsValid())
        std::wcout << L"gDiffuseMap ShaderResource is not valid" << std::endl;
}

FireEffect::~FireEffect() {
    m_DiffuseMapVariablePtr->Release();
    m_DiffuseMapVariablePtr = nullptr;
}

void FireEffect::SetMaterial(Material *material) {
    if(material->diffuseTexturePtr)
        m_DiffuseMapVariablePtr->SetResource(material->diffuseTexturePtr->GetSrv());
}