Skip to content

Commit

Permalink
Update wave-generator.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Spiri0 authored Nov 2, 2024
1 parent 5e945aa commit 6317724
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/waves/wave-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ export const wave_generator = (() => {
wave1Params[param] = wave_constants.FIRST_WAVE_DATASET[param].value;
this.waveSet1.add(wave1Params, param, paramBorders.min, paramBorders.max).onChange((value) => {
wave_constants.FIRST_WAVE_DATASET[param].value = value;
this.InitCascades();
this.UpdateOceanMaterial();
//this.InitCascades();
//this.UpdateOceanMaterial();

for(let i in this.cascades){
this.cascades[i].initialSpectrum.Update();
}
});
}
}
Expand All @@ -63,25 +67,29 @@ export const wave_generator = (() => {
wave2Params[param] = wave_constants.SECOND_WAVE_DATASET[param].value;
this.waveSet2.add(wave2Params, param, paramBorders.min, paramBorders.max).onChange((value) => {
wave_constants.SECOND_WAVE_DATASET[param].value = value;
this.InitCascades();
this.UpdateOceanMaterial();
//this.InitCascades();
//this.UpdateOceanMaterial();

for(let i in this.cascades){
this.cascades[i].initialSpectrum.Update();
}
});
}
}
this.waveSet3.add(wave_constants.FOAM_STRENGTH, "value", 0, 5).step(0.1).onChange((value) => {
wave_constants.FOAM_STRENGTH.value = value;
this.InitCascades();
this.UpdateOceanMaterial();
//this.InitCascades();
//this.UpdateOceanMaterial();
});
this.waveSet3.add(wave_constants.FOAM_THRESHOLD, "value", 0, 5).step(0.1).onChange((value) => {
wave_constants.FOAM_THRESHOLD.value = value;
this.InitCascades();
this.UpdateOceanMaterial();
//this.InitCascades();
//this.UpdateOceanMaterial();
});
this.oceanSet.add(wave_constants.LOD_SCALE, "value", 0, 20).step(0.1).onChange((value) => {
wave_constants.LOD_SCALE.value = value;
this.InitCascades();
this.UpdateOceanMaterial();
//this.InitCascades();
//this.UpdateOceanMaterial();
});


Expand Down Expand Up @@ -129,7 +137,7 @@ export const wave_generator = (() => {
}
}


/*
UpdateOceanMaterial() {
const ocean = this.FindEntity('ocean').GetComponent('OceanChunkManager');
ocean.material_.positionNode.parameters.displacement0.value = this.cascades[0].displacement;
Expand All @@ -145,7 +153,7 @@ export const wave_generator = (() => {
ocean.material_.colorNode.parameters.jacobian2.value = this.cascades[2].jacobian;
ocean.material_.colorNode.parameters.jacobian3.value = this.cascades[3].jacobian;
}

*/
}

return {
Expand Down

0 comments on commit 6317724

Please sign in to comment.