Official Codebase of 3DCodeVerse
Python
scene catalog: one water-body row — makeOceanSurface owns "ocean", makeOcean is its flat option
gaoypengec10955e2ddd
diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/water.js b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/water.jsindex ecf3f05f..ed4b4ac6 100644--- a/harness/codeverse3d/languages/scene_threejs/starter/src/lib/water.js+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/lib/water.js@@ -283,7 +283,9 @@ function _readScene(scene, uniforms, pinned) {}/**- * Build the scene's ONE reflective water plane (XZ, faces +Y).+ * Build the scene's ONE reflective water plane (XZ, faces +Y): the flat,+ * normal-mapped option for calm or distant water. Visible waves are+ * ocean.js's makeOceanSurface, which owns "ocean".* Returned mesh is at y = 0; set `position.y` to the water level.* Defaults are graded values — keep them unless the brief says not to.*diff --git a/harness/codeverse3d/prompts/scene_threejs/effects_catalog.md b/harness/codeverse3d/prompts/scene_threejs/effects_catalog.mdindex 2bdc4b32..def18fca 100644--- a/harness/codeverse3d/prompts/scene_threejs/effects_catalog.md+++ b/harness/codeverse3d/prompts/scene_threejs/effects_catalog.md@@ -19,7 +19,7 @@ says `import { makeGrass } from '../lib/grass.js';`, `src/scene.js` says| a small flame or wax candle | `makeFire({ radius, height, seed, quality: 'high' })` · `makeCandle({ radius, height, seed, lit: true })` — `lib/fire.js`; volumetric flame, moving illumination, wick and wax. Returns a Group with `userData.update(t, dt)`; use metres (candle radius about 0.025, height 0.15). Fire is transparent: avoid intersecting glass volumes. || a campfire, large fuel bed or flames through a building | `makeFireField({ emitters: [{ position: [0,0,0], radius: 0.3, height: 1, strength: 1 }], wind: [0.15,0], smoke: {height: 3, density: 0.65}, occluders: [fuel, walls], quality: 'balanced', seed })` — `lib/firefield.js`; all sources share one flame/soot integration. Wind is local metres/second. Optional borrowed opaque occluders truncate rays, including instancing/alpha cuts; custom deformation needs customDepthMaterial. No glass interleaving, skinned occluders or log-depth capture. Layout/wind are baked: rebuild to change them. Group provides update/dispose, bounds, sampleField(x,y,z,t), sampleEmber(index,t) and cost. Start with one field: each field adds a ray march over 3D textures, plus a depth pass when occluders are given. || rising smoke, steam from a cup or vent | `makeSmoke({ height: 3, radius: 0.14, wind: [0.06, 0], riseSpeed: 0.7, seed, quality: 'balanced' })` · `makeSteam({ height: 0.5, radius: 0.03 })` — `lib/smoke.js`; bounded 3D density with upward advection, widening, dilution and internal light attenuation. Mesh origin is the emitter at local y=0. `userData.update(t)`, `userData.sampleDensity(x,y,z,t)` and `userData.dispose()`. Directional/point/ambient scene lights illuminate it. Keep opaque geometry outside its `userData.bounds`; intersections and overlapping transparent volumes are not depth-resolved. |-| moving OCEAN waves with real displaced geometry | `makeOceanSurface({ width, depth, waveHeight, wavelength, windDirection: [1, 0.2], seed })` — `lib/ocean.js`; dispersive Gerstner waves, reflected scene, crest foam; Group with `userData.update(t, dt)` and `userData.sampleHeight(x, z, t)`. One reflective water body per scene. |+| the OCEAN, a lake or any sizeable water body | `makeOceanSurface({ width, depth, waveHeight, wavelength, windDirection: [1, 0.2], seed })` — `lib/ocean.js`, the ocean: dispersive Gerstner waves on real displaced geometry, reflected scene, crest foam; Group with `userData.update(t, dt)` and `userData.sampleHeight(x, z, t)`. Its flat option, for calm or distant water where no wave shape reads (a pond, a far lake): `makeOcean(w, d, { sunDir })` — `lib/water.js`, a normal-mapped mirror plane. ONE reflective water body per scene. || a curved shallow STREAM | `makeStream({ points: [[0, 0.6, -8], [2, 0.3, 0], [0, 0, 8]], width: 2, depth: 0.3, speed: 1, seed })` — `lib/stream.js`; points run upstream → downstream, decreasing Y. Refracts the opaque bed/scene through depth-varying water; flowing ripples, stone wakes and approximate caustics. `waterColor: 0x80b6a6, attenuationDistance: 3` controls volume absorption over a distance in metres. Optional `reflectionSize: 512` captures the banks; default 0, and at most ONE planar reflector per scene. Group with `userData.update(t, dt)`, `userData.sample(u, lateral, t)`. Keep terrain BELOW the bed inside the channel. || a falling sheet of water over a weir | `makeWaterfall({ width: 2, height: 3, speed: 1, thickness: 0.045, foam: 0.65, seed })` — `lib/waterfall.js`; gravity accelerates and thins the sheet, with advected ripples, local aeration and impact spray. Origin is impact water level, lip is `[0,height,0]`, flow is +Z. Supply the upstream water, cliff and pool. `userData.sample(u,lateral,t)` uses u=0..1 and lateral=-0.5..0.5; `userData.impact` gives the receiving point. No collision/fluid solver; opaque-scene refraction only. || thick broken ice with actual open fissures | `makeFracturedIce({ size: [8,6], thickness: 0.28, crackDensity: 0.65, frost: 0.35, seed })` — `lib/ice.js`; closed floes, bevels, internal air and local optical thickness. Nominal top is y=0. `userData.sampleHeight(x,z)` returns local top height or null in a gap. Supply an opaque lakebed/water backing: transparent volumes are not recursively refracted. |@@ -35,13 +35,12 @@ says `import { makeGrass } from '../lib/grass.js';`, `src/scene.js` says| flowers, drifting petals or leaves | `makeFlowers` · `makeFalling` — `lib/flowers.js` || midges, butterflies, fireflies; reeds in water | `makeInsects` · `makeReeds` — `lib/smalllife.js` || birds or fish in motion | `makeFlock({ count, kind, extent, height, path })` — `lib/flock.js` |-| a sizeable water body | `makeOcean(w, d, { sunDir })` — `lib/water.js`; ONE reflective surface per scene || mist over moving water, spray where it lands | `makeWaterMist` · `makeSpray` — `lib/watermist.js` || a waterline | `patchShoreWet` · `patchShoreFoam` · `patchShallowWater` — `lib/waterside.js` || anything BELOW the water, rain rings, thin ice | `patchUnderwater` · `makeRainRings` · `patchThinIce` — `lib/submerged.js` || the moving net of light under water | `patchCaustics(material, { level, sunDir })` — `lib/caustics.js`; goes on the surface being LIT, not on the water || moss, damp near water, dried mud | `patchMoss` · `patchMoisture` · `patchCrackedMud` — `lib/damp.js` |-| a polished or wet floor | `makeMirrorFloor(w, d)` — `lib/wetground.js`; re-renders the scene like `makeOcean` — use one or the other |+| a polished or wet floor | `makeMirrorFloor(w, d)` — `lib/wetground.js`; re-renders the scene like the water bodies — use one or the other || rock, cliff, ground | `patchTriplanar` · `patchSlopeSplat` — `lib/terrain_shade.js` || ground and cliff geometry | `ground({ size, rand: mulberry32(seed), relief, flat })` returns `{ mesh, height }` — seat every asset at height(x, z); with no seeded rand the ground is flat · `cliff({ length, height, rand })` — `lib/terrain.js` || placing a camera or a prop by intent | `seat` · `establishingShot` · `faceToward` · `alongPath` · `crowdOn` — `lib/place.js` |diff --git a/harness/tests/scene_runtime/lib/test_library.py b/harness/tests/scene_runtime/lib/test_library.pyindex ed6a62bb..01f6ad6a 100644--- a/harness/tests/scene_runtime/lib/test_library.py+++ b/harness/tests/scene_runtime/lib/test_library.py@@ -252,7 +252,7 @@ console.log(JSON.stringify({ exports, errors }));continuehave = {name for m in mods for name in exported[m]}# `name(` is a call into the row's own modules; a bare `name` may- # point at another row's (wetground's "re-renders like `makeOcean`")+ # point at another row's (meadow's "read by grass.js's `windOf`")called = set(re.findall(r"`([a-z][A-Za-z0-9]*)\(", row))named = set(re.findall(r"`([a-z][A-Za-z0-9]*)`", row)) - _PROSEstale += [f"{c} ({', '.join(mods)})" for c in sorted((called - have) | (named - anywhere))]