2019-09-29 00:30:53 +00:00
|
|
|
#include "Runtime/Graphics/Shaders/CRadarPaintShader.hpp"
|
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
#include "Runtime/Graphics/CGraphics.hpp"
|
|
|
|
#include "Runtime/Graphics/CTexture.hpp"
|
|
|
|
|
2022-02-01 00:06:54 +00:00
|
|
|
//#include <hecl/Pipeline.hpp>
|
2017-04-07 05:35:09 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2017-04-07 05:35:09 +00:00
|
|
|
|
2022-02-01 00:06:54 +00:00
|
|
|
//static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
2018-10-07 02:59:17 +00:00
|
|
|
|
2022-02-01 00:06:54 +00:00
|
|
|
void CRadarPaintShader::Initialize() {
|
|
|
|
// s_Pipeline = hecl::conv->convert(Shader_CRadarPaintShader{});
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2022-02-01 00:06:54 +00:00
|
|
|
void CRadarPaintShader::Shutdown() {
|
|
|
|
// s_Pipeline.reset();
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
void CRadarPaintShader::draw(const std::vector<Instance>& instances, const CTexture* tex) {
|
|
|
|
if (!instances.size())
|
|
|
|
return;
|
2019-07-21 08:42:52 +00:00
|
|
|
SCOPED_GRAPHICS_DEBUG_GROUP("CRadarPaintShader::draw", zeus::skMagenta);
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
if (instances.size() > m_maxInsts) {
|
|
|
|
m_maxInsts = instances.size();
|
|
|
|
m_tex = tex;
|
2022-02-01 00:06:54 +00:00
|
|
|
// CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx) {
|
|
|
|
// m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Instance), m_maxInsts);
|
|
|
|
// m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CMatrix4f), 1);
|
|
|
|
//
|
|
|
|
// const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> bufs{m_uniBuf.get()};
|
|
|
|
// constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Vertex};
|
|
|
|
// const std::array<boo::ObjToken<boo::ITexture>, 1> texs{m_tex->GetBooTexture()};
|
|
|
|
//
|
|
|
|
// m_dataBind =
|
|
|
|
// ctx.newShaderDataBinding(s_Pipeline, nullptr, m_vbo.get(), nullptr, bufs.size(), bufs.data(), stages.data(),
|
|
|
|
// nullptr, nullptr, texs.size(), texs.data(), nullptr, nullptr);
|
|
|
|
// return true;
|
|
|
|
// } BooTrace);
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
2022-03-05 23:30:30 +00:00
|
|
|
zeus::CMatrix4f uniMtx = CGraphics::GetPerspectiveProjectionMatrix(/*true*/) * CGraphics::g_GXModelView.toMatrix4f();
|
2022-02-01 00:06:54 +00:00
|
|
|
// m_uniBuf->load(&uniMtx, sizeof(zeus::CMatrix4f));
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
size_t mapSz = sizeof(Instance) * instances.size();
|
2022-02-01 00:06:54 +00:00
|
|
|
// Instance* insts = reinterpret_cast<Instance*>(m_vbo->map(mapSz));
|
|
|
|
// memmove(insts, instances.data(), mapSz);
|
|
|
|
// m_vbo->unmap();
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2022-02-01 00:06:54 +00:00
|
|
|
// CGraphics::SetShaderDataBinding(m_dataBind);
|
|
|
|
// CGraphics::DrawInstances(0, 4, instances.size());
|
2018-10-07 02:59:17 +00:00
|
|
|
}
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|