@plasius/gpu-shared 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +4 -1
- package/dist/index.cjs +10 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{showcase-runtime-55OVDYWT.js → showcase-runtime-2ZNPKD7D.js} +11 -3
- package/dist/{showcase-runtime-55OVDYWT.js.map → showcase-runtime-2ZNPKD7D.js.map} +1 -1
- package/package.json +11 -11
- package/src/showcase-runtime.js +12 -2
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ async function loadGltfModel(url) {
|
|
|
18
18
|
return module.loadGltfModel(url);
|
|
19
19
|
}
|
|
20
20
|
async function mountGpuShowcase(options = {}) {
|
|
21
|
-
const runtimeLoader = typeof options.__runtimeLoader === "function" ? options.__runtimeLoader : () => import("./showcase-runtime-
|
|
21
|
+
const runtimeLoader = typeof options.__runtimeLoader === "function" ? options.__runtimeLoader : () => import("./showcase-runtime-2ZNPKD7D.js");
|
|
22
22
|
const module = await runtimeLoader();
|
|
23
23
|
if (typeof module.mountGpuShowcase !== "function") {
|
|
24
24
|
throw new Error("showcase runtime loader must provide mountGpuShowcase.");
|
|
@@ -7191,6 +7191,12 @@ function sampleWave(state, x, z, time) {
|
|
|
7191
7191
|
const base = Math.sin(along * 0.22 - time * 1.12 * phaseSpeed) * 0.42 + Math.cos(along * 0.11 + cross * 0.07 - time * 0.78 * phaseSpeed) * 0.26 + Math.sin(cross * 0.19 - time * 1.34 * phaseSpeed) * 0.16;
|
|
7192
7192
|
return base * amplitude + sampleShipWake(state, x, z, time) + sampleWaveImpulses(state, x, z, time);
|
|
7193
7193
|
}
|
|
7194
|
+
function resolveFluidBandContinuity(continuity, band) {
|
|
7195
|
+
if (continuity?.bands && continuity.bands[band]) {
|
|
7196
|
+
return continuity.bands[band];
|
|
7197
|
+
}
|
|
7198
|
+
return continuity ?? { amplitudeFloor: 1, frequencyFloor: 1 };
|
|
7199
|
+
}
|
|
7194
7200
|
function buildWaterMotionEffects(state) {
|
|
7195
7201
|
const wakeTrails = [];
|
|
7196
7202
|
const rippleRings = state.waveImpulses.map((impulse) => {
|
|
@@ -7264,6 +7270,7 @@ function buildWaterBands(state, fluidDetail, visuals) {
|
|
|
7264
7270
|
for (const bandSpec of bandExtents) {
|
|
7265
7271
|
const representation = fluidPlan.representations.find((entry) => entry.band === bandSpec.band) ?? fluidPlan.representations[0];
|
|
7266
7272
|
const continuity = createFluidContinuityEnvelope({ fluidBodyId: "harbor" });
|
|
7273
|
+
const bandContinuity = resolveFluidBandContinuity(continuity, bandSpec.band);
|
|
7267
7274
|
const bandResolution = bandSpec.band === "near" ? fluidDetail.nearResolution : bandSpec.band === "mid" ? fluidDetail.midResolution : bandSpec.band === "far" ? 5 : 3;
|
|
7268
7275
|
const cols = Math.max(4, bandResolution * 2);
|
|
7269
7276
|
const rows = Math.max(4, bandResolution + 2);
|
|
@@ -7277,7 +7284,7 @@ function buildWaterBands(state, fluidDetail, visuals) {
|
|
|
7277
7284
|
const v = row / (rows - 1);
|
|
7278
7285
|
const x = originX + bandSpec.width * u;
|
|
7279
7286
|
const z = originZ + bandSpec.depth * v;
|
|
7280
|
-
const y = bandSpec.y + sampleWave(state, x, z, state.time) *
|
|
7287
|
+
const y = bandSpec.y + sampleWave(state, x, z, state.time) * bandContinuity.amplitudeFloor * (bandSpec.band === "near" ? 0.9 : bandSpec.band === "mid" ? 0.55 : 0.3);
|
|
7281
7288
|
positions.push(vec3(x, y, z));
|
|
7282
7289
|
}
|
|
7283
7290
|
}
|
|
@@ -7293,7 +7300,7 @@ function buildWaterBands(state, fluidDetail, visuals) {
|
|
|
7293
7300
|
bandMeshes.push({
|
|
7294
7301
|
band: bandSpec.band,
|
|
7295
7302
|
representation,
|
|
7296
|
-
continuity,
|
|
7303
|
+
continuity: bandContinuity,
|
|
7297
7304
|
rows,
|
|
7298
7305
|
cols,
|
|
7299
7306
|
positions,
|
|
@@ -8576,10 +8583,11 @@ function updatePhysicsSnapshot(state, shipModel) {
|
|
|
8576
8583
|
}
|
|
8577
8584
|
export {
|
|
8578
8585
|
advanceShowcaseClothSimulationState as __testOnlyAdvanceShowcaseClothSimulationState,
|
|
8586
|
+
buildWaterBands as __testOnlyBuildWaterBands,
|
|
8579
8587
|
buildWaterMotionEffects as __testOnlyBuildWaterMotionEffects,
|
|
8580
8588
|
collectSceneLightSources as __testOnlyCollectSceneLightSources,
|
|
8581
8589
|
createShowcaseClothSimulationState as __testOnlyCreateShowcaseClothSimulationState,
|
|
8582
8590
|
mountGpuShowcase,
|
|
8583
8591
|
showcaseFocusModes
|
|
8584
8592
|
};
|
|
8585
|
-
//# sourceMappingURL=showcase-runtime-
|
|
8593
|
+
//# sourceMappingURL=showcase-runtime-2ZNPKD7D.js.map
|