Skip to content

Commit

Permalink
Wind Waker: Draw 2D/UI particle groups with ortho view/proj matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
themikelester committed Jan 3, 2025
1 parent b09e553 commit ca3419e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/ZeldaWindWaker/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand Down

0 comments on commit ca3419e

Please sign in to comment.