2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-16 04:17:03 +00:00

CFluidPlane: Make use of std::array where applicable

Makes all the arrays strongly typed. We can also use type aliases to
greatly shorten some type definitions.
This commit is contained in:
Lioncash
2020-04-12 09:52:36 -04:00
parent 14f6dd2cd8
commit 5d85cd496a
7 changed files with 61 additions and 64 deletions

View File

@@ -12,6 +12,9 @@ namespace urde {
class CFluidUVMotion;
class CFluidPlaneCPU : public CFluidPlane {
public:
using SineTable = std::array<float, 256>;
protected:
class CTurbulence {
float x0_speed;
@@ -65,23 +68,17 @@ protected:
static bool PrepareRipple(const CRipple& ripple, const CFluidPlaneRender::SPatchInfo& info,
CFluidPlaneRender::SRippleInfo& rippleOut);
void ApplyTurbulence(float t, CFluidPlaneRender::SHFieldSample (&heights)[46][46], const u8 (&flags)[9][9],
const float sineWave[256], const CFluidPlaneRender::SPatchInfo& info,
const zeus::CVector3f& areaCenter) const;
void ApplyRipple(const CFluidPlaneRender::SRippleInfo& rippleInfo,
CFluidPlaneRender::SHFieldSample (&heights)[46][46], u8 (&flags)[9][9], const float sineWave[256],
const CFluidPlaneRender::SPatchInfo& info) const;
void ApplyRipples(const rstl::reserved_vector<CFluidPlaneRender::SRippleInfo, 32>& rippleInfos,
CFluidPlaneRender::SHFieldSample (&heights)[46][46], u8 (&flags)[9][9], const float sineWave[256],
const CFluidPlaneRender::SPatchInfo& info) const;
static void UpdatePatchNoNormals(CFluidPlaneRender::SHFieldSample (&heights)[46][46], const u8 (&flags)[9][9],
const CFluidPlaneRender::SPatchInfo& info);
static void UpdatePatchWithNormals(CFluidPlaneRender::SHFieldSample (&heights)[46][46], const u8 (&flags)[9][9],
const CFluidPlaneRender::SPatchInfo& info);
bool UpdatePatch(float time, const CFluidPlaneRender::SPatchInfo& info,
CFluidPlaneRender::SHFieldSample (&heights)[46][46], u8 (&flags)[9][9],
const zeus::CVector3f& areaCenter, const std::optional<CRippleManager>& rippleManager,
int fromX, int toX, int fromY, int toY) const;
void ApplyTurbulence(float t, Heights& heights, const Flags& flags, const SineTable& sineWave,
const CFluidPlaneRender::SPatchInfo& info, const zeus::CVector3f& areaCenter) const;
void ApplyRipple(const CFluidPlaneRender::SRippleInfo& rippleInfo, Heights& heights, Flags& flags,
const SineTable& sineWave, const CFluidPlaneRender::SPatchInfo& info) const;
void ApplyRipples(const rstl::reserved_vector<CFluidPlaneRender::SRippleInfo, 32>& rippleInfos, Heights& heights,
Flags& flags, const SineTable& sineWave, const CFluidPlaneRender::SPatchInfo& info) const;
static void UpdatePatchNoNormals(Heights& heights, const Flags& flags, const CFluidPlaneRender::SPatchInfo& info);
static void UpdatePatchWithNormals(Heights& heights, const Flags& flags, const CFluidPlaneRender::SPatchInfo& info);
bool UpdatePatch(float time, const CFluidPlaneRender::SPatchInfo& info, Heights& heights, Flags& flags,
const zeus::CVector3f& areaCenter, const std::optional<CRippleManager>& rippleManager, int fromX,
int toX, int fromY, int toY) const;
public:
CFluidPlaneCPU(CAssetId texPattern1, CAssetId texPattern2, CAssetId texColor, CAssetId bumpMap, CAssetId envMap,