2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-10 09:07:42 +00:00

Graphics/Shaders: Use std::array where applicable

Makes the arrays strongly typed and impervious to array->pointer decay.
This also allows simplifying some operations (such as being able to call
fill() instead of needing to use std::fill, etc).
This commit is contained in:
Lioncash
2019-09-28 22:22:12 -04:00
parent 417506572c
commit 136a229a1a
36 changed files with 530 additions and 347 deletions

View File

@@ -6,7 +6,7 @@
namespace urde {
static boo::ObjToken<boo::IShaderPipeline> s_Pipelines[4];
static std::array<boo::ObjToken<boo::IShaderPipeline>, 4> s_Pipelines;
void CFogVolumePlaneShader::Initialize() {
s_Pipelines[0] = hecl::conv->convert(Shader_CFogVolumePlaneShader0{});
@@ -26,9 +26,10 @@ void CFogVolumePlaneShader::CommitResources(size_t capacity) {
m_vertCapacity = capacity;
CGraphics::CommitResources([this, capacity](boo::IGraphicsDataFactory::Context& ctx) {
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(zeus::CVector4f), capacity);
for (int i = 0; i < 4; ++i)
for (size_t i = 0; i < m_dataBinds.size(); ++i) {
m_dataBinds[i] = ctx.newShaderDataBinding(s_Pipelines[i], m_vbo.get(), nullptr, nullptr, 0, nullptr, nullptr,
nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
return true;
} BooTrace);
}