Official Codebase of 3DCodeVerse
Python
lib: makeOcean loses two options no caller sets (legacyShader, hdrReflection)
gaoypeng094a6c6e5713
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/water.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/water.jsindex 3ad29b74..3ad3b634 100644--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/water.js+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/water.js@@ -10,8 +10,7 @@* stock look is a 30%-reflective milk with a flat +0.1 veil, which on* our pipeline (ACES, exposure 1.0, no post chain) renders a pool as* pale plastic — measured 2026-09-01, a still pool read mean_lum 0.73- * at BOTH a steep and a grazing view, i.e. no Fresnel at all. Pass- * `legacyShader: true` to get the addon's own tail back.+ * at BOTH a steep and a grazing view, i.e. no Fresnel at all.*/import * as THREE from 'three';@@ -301,9 +300,7 @@ function _readScene(scene, uniforms, pinned) {* `rf0` Fresnel reflectance head-on (default 0.02, real water);* `glitter` sun-track strength, 0 kills it (default 1);* `ambient` hex sky ambient for the water BODY (default: read off the- * scene's hemisphere/ambient light, else its fog);- * `hdrReflection` half-float mirror target (default true);- * `legacyShader` ship the addon's own tail instead (default false).+ * scene's hemisphere/ambient light, else its fog).* @returns {THREE.Mesh} The Water mesh, rotated flat, named 'Ocean',* with `userData.update(t)` driving the wave phase for `tick`.*/@@ -367,7 +364,7 @@ export function makeOcean(width, depth, opts = {}) {};// ---- the regrade: our pipeline, and the scene's own light ---------- if (opts.legacyShader !== true && _regrade(water.material)) {+ if (_regrade(water.material)) {uniforms.rf0 = { value: opts.rf0 === undefined ? 0.02 : opts.rf0 };uniforms.glitterScale ={ value: opts.glitter === undefined ? 1 : opts.glitter };@@ -402,9 +399,8 @@ export function makeOcean(width, depth, opts = {}) {// sky at ~0.002 linear reflects as two flat bands. Half-float// costs 2 bytes a texel on ONE 512px target and removes it.const mirror = uniforms.mirrorSampler.value;- if (opts.hdrReflection !== false- && (renderer.extensions.has('EXT_color_buffer_float')- || renderer.extensions.has('EXT_color_buffer_half_float'))) {+ if (renderer.extensions.has('EXT_color_buffer_float')+ || renderer.extensions.has('EXT_color_buffer_half_float')) {mirror.type = THREE.HalfFloatType;}}diff --git a/harness/tests/scene_runtime/lib/test_water.py b/harness/tests/scene_runtime/lib/test_water.pyindex ddb21a12..a833bf13 100644--- a/harness/tests/scene_runtime/lib/test_water.py+++ b/harness/tests/scene_runtime/lib/test_water.py@@ -104,9 +104,8 @@ for (let i = 0; i < nPond.image.data.length; i++) {const oHarbor = makeOcean(2800, 2800, { rttSize: 64 });const oForced = makeOcean(2800, 2800, { rttSize: 64, size: 5 });-// The regrade, and the addon tail it replaced.+// The regrade.const fs = o.material.fragmentShader;-const oLegacy = makeOcean(20, 20, { rttSize: 64, legacyShader: true });console.log(JSON.stringify({identical,@@ -144,9 +143,6 @@ console.log(JSON.stringify({keepsToneMap: fs.indexOf('tonemapping_fragment') >= 0&& fs.indexOf('colorspace_fragment') >= 0,gatedGlitter: fs.indexOf('reflectionSample * specularLight') >= 0,- legacyVeil: oLegacy.material.fragmentShader.indexOf(- 'vec3( 0.1 ) + reflectionSample') >= 0,- legacyExtras: oLegacy.material.uniforms.rf0 !== undefined,}));"""@@ -390,15 +386,6 @@ def test_the_regrade_keeps_our_pipelines_fragment_tail(probe) -> None:assert probe["keepsToneMap"], "tonemapping/colorspace chunks lost"-def test_legacy_shader_opts_all_the_way_out(probe) -> None:- """An escape hatch has to be a real one: `legacyShader` must ship the- addon's own tail, uniforms and all, for a scene graded against it."""- m = probe- assert m["legacyVeil"], "legacyShader did not restore the addon tail"- assert not m["legacyExtras"], (- "legacyShader still declared the regrade's uniforms")--def test_first_render_points_the_water_at_the_scenes_own_key(sniff) -> None:"""Water is built before the scene exists, so its light is a guessuntil the first frame. Left as the shipped guess, a night pool