Skip to content

Commit

Permalink
Wind Waker: Fix projection particles
Browse files Browse the repository at this point in the history
Wind Waker patches the GX material at runtime to respect A0, so we need to do the same.
  • Loading branch information
magcius committed Jan 1, 2025
1 parent 34762a7 commit 976bfe0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ZeldaWindWaker/d_particle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,26 @@ export class dPa_control_c {
return null;
}

private patchResData(globals: dGlobals, resData: JPAResourceData): void {
if (resData.resourceId & 0x4000) {
const m = resData.materialHelper.material;
m.tevStages[0].alphaInA = GX.CA.ZERO;
m.tevStages[0].alphaInB = GX.CA.ZERO;
m.tevStages[0].alphaInC = GX.CA.ZERO;
m.tevStages[0].alphaInD = GX.CA.A0;

resData.materialHelper.materialInvalidated();
}
}

private getResData(globals: dGlobals, userIndex: number): JPAResourceData | null {
if (!this.resourceDatas.has(userIndex)) {
const data = this.findResData(userIndex);
if (data !== null) {
const [jpacData, jpaResRaw] = data;
const device = globals.modelCache.device, cache = globals.modelCache.cache;
const resData = new JPAResourceData(device, cache, jpacData, jpaResRaw);
this.patchResData(globals, resData);
this.resourceDatas.set(userIndex, resData);
}
}
Expand Down

0 comments on commit 976bfe0

Please sign in to comment.