2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-11 21:44:00 +00:00

CFluidUVMotion: Return std::array by value from CalculateFluidTextureOffset()

Same behavior, but allows for easier use of API and makes it harder to
misuse. It also makes it easier for analysis to determine out of bounds,
given we leverage std::array rather than a pointer that causes arrays to
decay and lose their size information.
This commit is contained in:
Lioncash
2020-04-12 09:20:22 -04:00
parent 3c8619ba44
commit 14f6dd2cd8
4 changed files with 26 additions and 19 deletions

View File

@@ -128,11 +128,11 @@ CFluidPlaneShader::RenderSetupInfo CFluidPlaneCPU::RenderSetup(const CStateManag
const CScriptWater* water) {
CFluidPlaneShader::RenderSetupInfo out;
float uvT = mgr.GetFluidPlaneManager()->GetUVT();
bool hasBumpMap = HasBumpMap() && kEnableWaterBumpMaps;
const float uvT = mgr.GetFluidPlaneManager()->GetUVT();
const bool hasBumpMap = HasBumpMap() && kEnableWaterBumpMaps;
bool doubleLightmapBlend = false;
bool hasEnvMap = mgr.GetCameraManager()->GetFluidCounter() == 0 && HasEnvMap();
bool hasEnvBumpMap = HasEnvBumpMap();
const bool hasEnvMap = mgr.GetCameraManager()->GetFluidCounter() == 0 && HasEnvMap();
const bool hasEnvBumpMap = HasEnvBumpMap();
InitializeSineWave();
CGraphics::SetModelMatrix(xf);
@@ -165,8 +165,7 @@ CFluidPlaneShader::RenderSetupInfo CFluidPlaneCPU::RenderSetup(const CStateManag
curTex++;
}
float fluidUVs[3][2];
x4c_uvMotion.CalculateFluidTextureOffset(uvT, fluidUVs);
const auto fluidUVs = x4c_uvMotion.CalculateFluidTextureOffset(uvT);
out.texMtxs[0][0][0] = x4c_uvMotion.GetFluidLayers()[1].GetUVScale();
out.texMtxs[0][1][1] = x4c_uvMotion.GetFluidLayers()[1].GetUVScale();