Skip to content

Commit

Permalink
Wind Waker: Add frustum culling for simple emitters
Browse files Browse the repository at this point in the history
  • Loading branch information
themikelester committed Jan 3, 2025
1 parent 8c65343 commit 07df049
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/ZeldaWindWaker/d_particle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,20 +287,21 @@ class dPa_simpleEcallBack extends JPAEmitterCallBack {

emitter.playCreateParticle();
for (let simple of this.datas) {
// TODO: Frustum culling
emitter.setGlobalTranslation(workData.emitterTranslation);
colorCopy(emitter.globalColorPrm, simple.prmColor);
colorCopy(emitter.globalColorEnv, simple.envColor);
for (let i = 0; i < emitThisFrame; i++) {
const particle = emitter.createParticle();
if (!particle)
break;

// NOTE: Overwriting this removes the influence of the local emitter translation (bem.emitterTrs)
// I.e. all simple emitters ignore their local offsets and are fixed to the local origin.
vec3.copy(particle.offsetPosition, simple.pos);
if (simple.isAffectedByWind) {
// TODO: Wind callback
if (!workData.frustum || workData.frustum.containsSphere(simple.pos, 200)) {
emitter.setGlobalTranslation(simple.pos);
colorCopy(emitter.globalColorPrm, simple.prmColor);
colorCopy(emitter.globalColorEnv, simple.envColor);
for (let i = 0; i < emitThisFrame; i++) {
const particle = emitter.createParticle();
if (!particle)
break;

// NOTE: Overwriting this removes the influence of the local emitter translation (bem.emitterTrs)
// I.e. all simple emitters ignore their local offsets and are fixed to the local origin.
vec3.copy(particle.offsetPosition, simple.pos);
if (simple.isAffectedByWind) {
// TODO: Wind callback
}
}
}
}
Expand Down

0 comments on commit 07df049

Please sign in to comment.