mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-08 13:04:55 +00:00
Initial CFluidPlaneDoor
This commit is contained in:
@@ -8343,9 +8343,9 @@ UpdatePatchWithNormals__FPCUcPCUcQ220CFluidPlaneCPURender10SPatchInfo = .text:0x
|
||||
__dt__11CTurbulenceFv = .text:0x8019CB34; // type:function size:0x54 scope:global
|
||||
__ct__Q214CFluidPlaneCPU11CTurbulenceFffffffff = .text:0x8019CB88; // type:function size:0x238 scope:global
|
||||
__ct__14CFluidPlaneCPUFUiUiUiUiUiUifUiQ211CFluidPlane10EFluidTypefRC9CVector3ffRC14CFluidUVMotionfffffffffffff = .text:0x8019CDC0; // type:function size:0x5E0 scope:global
|
||||
fn_8019D3A0 = .text:0x8019D3A0; // type:function size:0x4
|
||||
fn_8019D3A4 = .text:0x8019D3A4; // type:function size:0x4
|
||||
fn_8019D3A8 = .text:0x8019D3A8; // type:function size:0x4
|
||||
AddRipple__15CFluidPlaneDoorFRC7CRippleRC12CScriptWaterR13CStateManager = .text:0x8019D3A0; // type:function size:0x4
|
||||
AddRipple__15CFluidPlaneDoorFf9TUniqueIdRC9CVector3fRC9CVector3fRC12CScriptWaterR13CStateManagerRC9CVector3f = .text:0x8019D3A4; // type:function size:0x4
|
||||
AddRipple__15CFluidPlaneDoorFf9TUniqueIdRC9CVector3fRC12CScriptWaterR13CStateManager = .text:0x8019D3A8; // type:function size:0x4
|
||||
RenderCleanup__15CFluidPlaneDoorCFv = .text:0x8019D3AC; // type:function size:0x78 scope:global
|
||||
Render__15CFluidPlaneDoorCFRC13CStateManagerRC6CAABoxRC14CFrustumPlanesRC14CRippleManagerRC9CVector3f = .text:0x8019D424; // type:function size:0x3E8 scope:global
|
||||
RenderSetup__15CFluidPlaneDoorCFRC13CStateManagerfRC12CTransform4fRC6CAABox = .text:0x8019D80C; // type:function size:0x3F4 scope:global
|
||||
|
||||
@@ -4,6 +4,26 @@
|
||||
#include "MetroidPrime/CFluidPlaneManager.hpp"
|
||||
|
||||
class CFluidPlaneDoor : public CFluidPlane {
|
||||
public:
|
||||
CFluidPlaneDoor(CAssetId texPattern1, CAssetId texPattern2, CAssetId texColor, float tileSize,
|
||||
uint tileSubdivisions, EFluidType type, float alpha,
|
||||
const CFluidUVMotion& uvMotion);
|
||||
~CFluidPlaneDoor() override;
|
||||
|
||||
void RenderSetup(const CStateManager& mgr, float alpha, const CTransform4f& xf,
|
||||
const CAABox& bounds) const;
|
||||
void AddRipple(const float mag, const TUniqueId rippler, const CVector3f& center,
|
||||
const CScriptWater& water, CStateManager& mgr) override {}
|
||||
void AddRipple(float intensity, TUniqueId rippler, const CVector3f& center,
|
||||
const CVector3f& velocity, const CScriptWater& water, CStateManager& mgr,
|
||||
const CVector3f& upVec) override {}
|
||||
void AddRipple(const CRipple& ripple, const CScriptWater& water, CStateManager& mgr) override {}
|
||||
void Update() override;
|
||||
void Render(const CStateManager& mgr, const CAABox&, const CFrustumPlanes&, const CRippleManager&,
|
||||
const CVector3f&) override;
|
||||
|
||||
void RenderCleanup() const;
|
||||
|
||||
private:
|
||||
float xa0_tileSize;
|
||||
int xa4_tileSubdivisions;
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
kFT_ThickLava
|
||||
};
|
||||
|
||||
CFluidPlane(const CAssetId texPattern1, const CAssetId texPattern2, const CAssetId texColor,
|
||||
CFluidPlane(const CAssetId texPattern1, const CAssetId texPattern2, CAssetId texColor,
|
||||
const float alpha, const EFluidType fluidType, const float rippleIntensity,
|
||||
const CFluidUVMotion& motion);
|
||||
virtual ~CFluidPlane();
|
||||
@@ -63,9 +63,9 @@ public:
|
||||
const CVector3f& velocity, const CScriptWater& water, CStateManager& mgr,
|
||||
const CVector3f& upVec);
|
||||
virtual void AddRipple(const CRipple& ripple, const CScriptWater& water, CStateManager& mgr);
|
||||
virtual void Update();
|
||||
virtual void Render(const CStateManager& mgr, const CAABox&, const CFrustumPlanes&,
|
||||
const CRippleManager&, const CVector3f&);
|
||||
// Update__11CFluidPlaneFv
|
||||
|
||||
float CalculateRippleIntensity(const float base) const;
|
||||
float GetRippleScaleFromKineticEnergy(float baseI, float velDot);
|
||||
@@ -73,19 +73,18 @@ public:
|
||||
float GetAlpha() const { return x40_alpha; }
|
||||
EFluidType GetFluidType() const { return x44_fluidType; }
|
||||
const CFluidUVMotion& GetUVMotion() const { return x4c_uvMotion; }
|
||||
// GetColorTexture__11CFluidPlaneCFv
|
||||
// HasColorTexture__11CFluidPlaneCFv
|
||||
// GetTexturePattern2__11CFluidPlaneCFv
|
||||
// HasTexturePattern2__11CFluidPlaneCFv
|
||||
// GetTexturePattern1__11CFluidPlaneCFv
|
||||
// HasTexturePattern1__11CFluidPlaneCFv
|
||||
|
||||
const TLockedToken< CTexture >& GetTexturePattern1() const { return *x10_texPattern1; }
|
||||
bool HasTexturePattern1() const { return x10_texPattern1; }
|
||||
const TLockedToken< CTexture >& GetTexturePattern2() const { return *x20_texPattern2; }
|
||||
bool HasTexturePattern2() const { return x20_texPattern2; }
|
||||
const TLockedToken< CTexture >& GetColorTexture() const { return *x30_texColor; }
|
||||
bool HasColorTexture() const { return x30_texColor; }
|
||||
static const float GetRippleIntensityRange() { return kRippleIntensityRange; }
|
||||
|
||||
protected:
|
||||
virtual void RenderStripWithRipples(const CFluidPlaneCPURender::SHFieldSample& heights,
|
||||
const unsigned char& flags, float curY, int startYDiv,
|
||||
const CFluidPlaneCPURender::SPatchInfo& info);
|
||||
void RenderStripWithRipples(const CFluidPlaneCPURender::SHFieldSample& heights,
|
||||
const unsigned char& flags, float curY, int startYDiv,
|
||||
const CFluidPlaneCPURender::SPatchInfo& info);
|
||||
|
||||
CAssetId x4_texPattern1Id;
|
||||
CAssetId x8_texPattern2Id;
|
||||
@@ -112,6 +111,8 @@ public:
|
||||
float GetLastSplashDeltaTime(TUniqueId uid) const;
|
||||
float GetLastRippleDeltaTime(TUniqueId uid) const;
|
||||
|
||||
float GetUVTime() const { return x11c_uvT; }
|
||||
|
||||
private:
|
||||
class CSplashRecord {
|
||||
float x0_time;
|
||||
|
||||
71
src/MetroidPrime/CFluidPlaneDoor.cpp
Normal file
71
src/MetroidPrime/CFluidPlaneDoor.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#include "MetroidPrime/CFluidPlaneDoor.hpp"
|
||||
#include "Kyoto/Graphics/CTexture.hpp"
|
||||
#include "MetaRender/CCubeRenderer.hpp"
|
||||
#include "dolphin/gx/GXEnum.h"
|
||||
#include "dolphin/gx/GXTransform.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
#include <Kyoto/Graphics/CGX.hpp>
|
||||
|
||||
CFluidPlaneDoor::CFluidPlaneDoor(const CAssetId texPattern1, const CAssetId texPattern2,
|
||||
const CAssetId texColor, const float tileSize,
|
||||
const uint tileSubdivisions, const EFluidType fluidType,
|
||||
const float alpha, const CFluidUVMotion& uvMotion)
|
||||
: CFluidPlane(texPattern1, texPattern2, texColor, alpha, fluidType, 0.5f, uvMotion)
|
||||
, xa0_tileSize(tileSize)
|
||||
, xa4_tileSubdivisions(tileSubdivisions & ~1)
|
||||
, xa8_rippleResolution(tileSize / xa4_tileSubdivisions) {}
|
||||
|
||||
CFluidPlaneDoor::~CFluidPlaneDoor() {}
|
||||
|
||||
void CFluidPlaneDoor::RenderSetup(const CStateManager& mgr, float alpha, const CTransform4f& xf,
|
||||
const CAABox& bounds) const {
|
||||
static GXColor white = {255, 255, 255, 255};
|
||||
float uvT = mgr.GetFluidPlaneManager()->GetUVTime();
|
||||
gpRender->SetModelMatrix(xf);
|
||||
CGX::SetChanMatColor(CGX::Channel0, white);
|
||||
CGX::SetChanCtrl(CGX::Channel0, false, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE,
|
||||
GX_AF_NONE);
|
||||
CGX::SetNumChans(0);
|
||||
|
||||
if (HasTexturePattern1()) {
|
||||
GetTexturePattern1()->Load(GX_TEXMAP0, CTexture::kCM_Repeat);
|
||||
}
|
||||
|
||||
if (HasTexturePattern2()) {
|
||||
GetTexturePattern2()->Load(GX_TEXMAP1, CTexture::kCM_Repeat);
|
||||
}
|
||||
|
||||
if (HasColorTexture()) {
|
||||
GetColorTexture()->Load(GX_TEXMAP2, CTexture::kCM_Repeat);
|
||||
}
|
||||
|
||||
float uvs[3][2];
|
||||
GetUVMotion().CalculateFluidTextureOffset(uvT, uvs);
|
||||
static const float skZeroMatrix[2][4] = {0.f};
|
||||
|
||||
float scale0[2][4];
|
||||
float scale1[2][4];
|
||||
float scale2[2][4];
|
||||
|
||||
scale1[0][0] = GetUVMotion().GetFluidLayers()[0].x14_uvScale;
|
||||
scale2[0][0] = GetUVMotion().GetFluidLayers()[1].x14_uvScale;
|
||||
scale0[0][0] = GetUVMotion().GetFluidLayers()[0].x14_uvScale;
|
||||
scale1[0][3] = uvs[1][0];
|
||||
scale1[1][3] = uvs[1][1];
|
||||
scale2[0][3] = uvs[2][0];
|
||||
scale2[1][3] = uvs[2][1];
|
||||
scale0[0][3] = uvs[0][0];
|
||||
scale0[1][3] = uvs[0][1];
|
||||
|
||||
GXLoadTexMtxImm(scale1, GX_TEXMTX5, GX_MTX2x4);
|
||||
GXLoadTexMtxImm(scale2, GX_TEXMTX6, GX_MTX2x4);
|
||||
GXLoadTexMtxImm(scale0, GX_TEXMTX7, GX_MTX2x4);
|
||||
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_POS, GX_TEXMTX5, false, GX_PTIDENTITY);
|
||||
}
|
||||
|
||||
void CFluidPlaneDoor::Render(const CStateManager& mgr, const CAABox&, const CFrustumPlanes&,
|
||||
const CRippleManager&, const CVector3f&) {}
|
||||
|
||||
void CFluidPlaneDoor::RenderCleanup() const {}
|
||||
Reference in New Issue
Block a user