Merge pull request #263 from lioncash/array3

CDecal: Make use of std::array where applicable
This commit is contained in:
Phillip Stephens 2020-03-23 23:28:08 -07:00 committed by GitHub
commit 425f8d4cc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -25,16 +25,17 @@ CDecal::CDecal(const TToken<CDecalDescription>& desc, const zeus::CTransform& xf
if (d->x50_DMRT) if (d->x50_DMRT)
d->x50_DMRT->GetValue(0, x60_rotation); d->x50_DMRT->GetValue(0, x60_rotation);
} else } else {
x5c_29_modelInvalid = true; x5c_29_modelInvalid = true;
}
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx) { CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx) {
for (int i = 0; i < 2; ++i) { for (auto& decal : x3c_decalQuads) {
CQuadDecal& decal = x3c_decalQuads[i]; if (decal.m_desc->x14_TEX) {
if (decal.m_desc->x14_TEX)
decal.m_instBuf = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(SParticleInstanceTex), 1); decal.m_instBuf = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(SParticleInstanceTex), 1);
else } else {
decal.m_instBuf = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(SParticleInstanceNoTex), 1); decal.m_instBuf = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(SParticleInstanceNoTex), 1);
}
decal.m_uniformBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(SParticleUniforms), 1); decal.m_uniformBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(SParticleUniforms), 1);
CDecalShaders::BuildShaderDataBinding(ctx, decal); CDecalShaders::BuildShaderDataBinding(ctx, decal);
} }

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <array>
#include "Runtime/CRandom16.hpp" #include "Runtime/CRandom16.hpp"
#include "Runtime/CToken.hpp" #include "Runtime/CToken.hpp"
#include "Runtime/RetroTypes.hpp" #include "Runtime/RetroTypes.hpp"
@ -36,7 +38,7 @@ class CDecal {
TLockedToken<CDecalDescription> x0_description; TLockedToken<CDecalDescription> x0_description;
zeus::CTransform xc_transform; zeus::CTransform xc_transform;
CQuadDecal x3c_decalQuads[2]; std::array<CQuadDecal, 2> x3c_decalQuads;
s32 x54_modelLifetime = 0; s32 x54_modelLifetime = 0;
s32 x58_frameIdx = 0; s32 x58_frameIdx = 0;
union { union {