From ca3419e2332855c55b26aa21171a253b42217341 Mon Sep 17 00:00:00 2001 From: Mike Lester Date: Fri, 3 Jan 2025 12:03:17 -0700 Subject: [PATCH] Wind Waker: Draw 2D/UI particle groups with ortho view/proj matrices --- src/ZeldaWindWaker/Main.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ZeldaWindWaker/Main.ts b/src/ZeldaWindWaker/Main.ts index 1ae7a533e..0ac56fa35 100644 --- a/src/ZeldaWindWaker/Main.ts +++ b/src/ZeldaWindWaker/Main.ts @@ -403,7 +403,7 @@ export class WindWakerRenderer implements Viewer.SceneGfx { { globals.particleCtrl.calc(globals, viewerInput); - for (let group = ParticleGroup.Normal; group <= ParticleGroup.TwoDmenuBack; group++) { + for (let group = ParticleGroup.Normal; group <= ParticleGroup.Wind; group++) { let texPrjMtx: mat4 | null = null; if (group === ParticleGroup.Projection) { @@ -415,6 +415,19 @@ export class WindWakerRenderer implements Viewer.SceneGfx { renderInstManager.setCurrentList(dlst.effect[group == ParticleGroup.Projection ? EffectDrawGroup.Indirect : EffectDrawGroup.Main]); globals.particleCtrl.draw(device, this.renderHelper.renderInstManager, group); } + + // From mDoGph_Painter(). Draw the 2D particle groups with 640x480 ortho matrices. + for (let group = ParticleGroup.TwoDfore; group <= ParticleGroup.TwoDmenuBack; group++) { + const orthoCtx = this.globals.scnPlay.currentGrafPort; + const viewMtx = mat4.fromTranslation(scratchMatrix, [orthoCtx.aspectRatioCorrection * 320, 240, 0]); + const frustum = orthoCtx.getFrustumForView(viewMtx); + const template = renderInstManager.pushTemplate(); + orthoCtx.setOnRenderInst(template); + + globals.particleCtrl.setDrawInfo(viewMtx, orthoCtx.sceneParams.u_Projection, null, frustum); + renderInstManager.setCurrentList(dlst.effect[EffectDrawGroup.Main]); + globals.particleCtrl.draw(device, this.renderHelper.renderInstManager, group); + } } this.renderHelper.renderInstManager.popTemplate();