Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement d_wood (bushes) for Wind Waker #712

Merged
merged 24 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
22c92a3
Update zww_extractor.ts to create the output directory if it does not…
themikelester Oct 18, 2024
d1a3701
Merge branch 'magcius:master' into master
themikelester Oct 18, 2024
a28b3f5
zww_extractor.ts now copies the res/* into the output directory
themikelester Oct 18, 2024
ca68e17
Add d_wood.o symbols to zww_extractor.ts
themikelester Oct 18, 2024
94ee660
Added d_wood.ts. Basic bush rendering.
themikelester Oct 18, 2024
b626b94
Merge branch 'master' of https://github.com/themikelester/noclip.website
themikelester Oct 18, 2024
a5799f0
Add cLib_chaseS() function to SComponent
themikelester Oct 21, 2024
a3efb18
Add mDoMtx_copy() to m_do_mtx
themikelester Oct 21, 2024
5c67def
Update d_wood.ts to about 70%
themikelester Oct 21, 2024
283aac3
d_wood alpha improvements
themikelester Oct 21, 2024
0744eba
Add frustum culling to d_wood
themikelester Oct 22, 2024
bc9d19b
d_wood: const enum fixup
themikelester Oct 23, 2024
e21426c
Revert "zww_extractor.ts now copies the res/* into the output directory"
themikelester Oct 23, 2024
9981b0b
d_wood: Cleanup sway attribute data and naming
themikelester Oct 23, 2024
805a1d0
Remove cLib_chaseS implementation, use cLib_chaseF instead
themikelester Oct 23, 2024
4f57aaf
d_wood: Add public/private to all member functions
themikelester Oct 23, 2024
6bf9d19
d_wood: don't cache globals, pass it as a param everywhere it's needed
themikelester Oct 23, 2024
d46ece9
d_wood: Fix shadow scale. Use math helpers for simpler matrix calcula…
themikelester Oct 24, 2024
c6f5bbc
d_wood: Correctly use the g_dTree_shadowTexCoord
themikelester Oct 24, 2024
fc9ff95
d_wood: Remove unnecessary transpose
themikelester Oct 24, 2024
b191a8a
d_wood: Replace Room_c linked list with a 2D array
themikelester Oct 24, 2024
acf6ac3
d_wood: Remove byte offset comments from classes
themikelester Oct 24, 2024
c01ae25
d_wood: Remove some unused animations
themikelester Oct 24, 2024
5209d78
d_wood: Whoops. Fix some build errors related to extra params
themikelester Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/ZeldaWindWaker/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { GfxrAttachmentSlot, GfxrRenderTargetDescription } from '../gfx/render/G
import { GfxRenderInstList, GfxRenderInstManager } from '../gfx/render/GfxRenderInstManager.js';
import { GXRenderHelperGfx, fillSceneParamsDataOnTemplate } from '../gx/gx_render.js';
import { FlowerPacket, GrassPacket, TreePacket } from './Grass.js';
import { Packet_c as WoodPacket } from './d_wood.js';
import { LegacyActor__RegisterFallbackConstructor } from './LegacyActor.js';
import { dDlst_2DStatic_c, d_a__RegisterConstructors } from './d_a.js';
import { d_a_sea } from './d_a_sea.js';
Expand Down Expand Up @@ -739,6 +740,7 @@ class d_s_play extends fopScn {
public flowerPacket: FlowerPacket;
public treePacket: TreePacket;
public grassPacket: GrassPacket;
public woodPacket: WoodPacket;

public vrboxLoaded: boolean = false;

Expand All @@ -748,6 +750,7 @@ class d_s_play extends fopScn {
this.treePacket = new TreePacket(globals);
this.flowerPacket = new FlowerPacket(globals);
this.grassPacket = new GrassPacket(globals);
this.woodPacket = new WoodPacket(globals);

globals.scnPlay = this;

Expand All @@ -757,22 +760,25 @@ class d_s_play extends fopScn {
public override draw(globals: dGlobals, renderInstManager: GfxRenderInstManager, viewerInput: Viewer.ViewerRenderInput): void {
super.draw(globals, renderInstManager, viewerInput);

// Grass/Flowers/Trees
// Magma/Grass/Trees/Bushes/Flowers
const frameCount = viewerInput.time / 1000.0 * 30;

this.flowerPacket.calc(frameCount);
this.treePacket.calc(frameCount);
this.grassPacket.calc(frameCount);
this.woodPacket.calc(globals, frameCount);

this.flowerPacket.update(globals);
this.treePacket.update(globals);
this.grassPacket.update(globals);
this.woodPacket.update(globals);

fopDw_Draw(globals.frameworkGlobals, globals, renderInstManager, viewerInput);

this.flowerPacket.draw(globals, renderInstManager, viewerInput);
this.treePacket.draw(globals, renderInstManager, viewerInput);
this.grassPacket.draw(globals, renderInstManager, viewerInput);
this.woodPacket.draw(globals, renderInstManager, viewerInput);
}

public override delete(globals: dGlobals): void {
Expand All @@ -782,6 +788,7 @@ class d_s_play extends fopScn {
this.flowerPacket.destroy(device);
this.treePacket.destroy(device);
this.grassPacket.destroy(device);
this.woodPacket.destroy(device);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/ZeldaWindWaker/SComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ export function cLib_chasePosXZ(dst: vec3, target: ReadonlyVec3, maxVel: number)
}
}

// Move `value` closer to `target` by the amount specified in `step`.
// If `value` would cross `target`, it is set to `target`. Returns 1 if value has reached the target, 0 otherwise.
export function cLib_chaseF(dst: number, target: number, step: number): number {
if (step !== 0) {
if (dst > target) {
Expand Down
11 changes: 11 additions & 0 deletions src/ZeldaWindWaker/d_a.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4116,6 +4116,16 @@ class d_a_oship extends fopAc_ac_c implements ModeFuncExec<d_a_oship_mode> {
}
}

class d_a_obj_wood extends fopAc_ac_c {
public static PROCESS_NAME = fpc__ProcessName.d_a_obj_wood;

public override subload(globals: dGlobals): cPhs__Status {
globals.scnPlay.woodPacket.put_unit(globals, this.pos, this.roomNo);
// globals.scnPlay.treePacket.newData(this.pos, 0, this.roomNo);
return cPhs__Status.Next;
}
}

const enum d_a_obj_flame_mode { wait, wait2, l_before, l_u, u, u_l, l_after }
const enum d_a_obj_em_state { Off, TurnOn, On, TurnOff }
class d_a_obj_flame extends fopAc_ac_c {
Expand Down Expand Up @@ -4711,6 +4721,7 @@ export function d_a__RegisterConstructors(globals: fGlobals): void {
}

R(d_a_grass);
R(d_a_obj_wood);
R(d_a_ep);
R(d_a_bg);
R(d_a_vrbox);
Expand Down
Loading