Official Codebase of 3DCodeVerse
Python
scene_threejs: starter shaders/sky.js goes, and two stale facts about the library
gaoypeng8e61f5bbfadc
diff --git a/harness/codeverse3d/languages/scene_threejs/__init__.py b/harness/codeverse3d/languages/scene_threejs/__init__.pyindex 42a481e0..7ef10300 100644--- a/harness/codeverse3d/languages/scene_threejs/__init__.py+++ b/harness/codeverse3d/languages/scene_threejs/__init__.py@@ -171,7 +171,7 @@ def lint(ws: Workspace) -> GateReport:# ===================================================================== skeletonSTARTER_DIR = Path(__file__).resolve().parent / "starter" / "src"#: pattern files copied verbatim in plan mode (shown as reusable examples)-PATTERN_FILES = ("shaders/sky.js", "shaders/water.js", "assets/pine_tree.js", "assets/windmill.js")+PATTERN_FILES = ("shaders/water.js", "assets/pine_tree.js", "assets/windmill.js")#: the harness-owned effect library (``src/lib/*.js``), shipped into EVERY workspace.#: Plan mode copied only PATTERN_FILES, so a planned run got the effects catalog in its#: prompt and no ``src/lib/`` to import from — every ``from './lib/grass.js'`` a 2026-09-01diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/scene.js b/harness/codeverse3d/languages/scene_threejs/starter/src/scene.jsindex 628f4701..78c139ce 100644--- a/harness/codeverse3d/languages/scene_threejs/starter/src/scene.js+++ b/harness/codeverse3d/languages/scene_threejs/starter/src/scene.js@@ -9,7 +9,7 @@// • loaders.gltf is a GLTFLoader: loaders.gltf.loadAsync('/assets/<name>.glb') for Blender-built assets.// • Imports allowed: 'three', 'three/addons/*', relative files. No CDN, no network, no DOM access.// • Raw three.js + GLSL only: never import a helper SDK or any npm package.-// ./lib/ is the ONE exception and is not an SDK: 52 harness-owned effect modules+// ./lib/ is the ONE exception and is not an SDK: 44 harness-owned effect modules// shipped INTO this workspace, already compiled and rendered on this renderer.// Import and call them (`import { makeGrass } from './lib/grass.js'`); do not// rewrite them — writes to src/lib/ are reverted. Table: prompts effects_catalog.diff --git a/harness/codeverse3d/languages/scene_threejs/starter/src/shaders/sky.js b/harness/codeverse3d/languages/scene_threejs/starter/src/shaders/sky.jsdeleted file mode 100644index c7c71bd1..00000000--- a/harness/codeverse3d/languages/scene_threejs/starter/src/shaders/sky.js+++ /dev/null@@ -1,46 +0,0 @@-// src/shaders/sky.js — gradient sky dome (raw GLSL in a ShaderMaterial).-// Pattern: uniforms object + vertex/fragment strings + `#include` chunks ALONE on their line.-// No #version / precision lines (three.js prepends them). gl_FragColor is fine (no glslVersion).-import * as THREE from 'three';--const vertexShader = /* glsl */ `-varying vec3 vWorldDir;-void main() {- vec4 wp = modelMatrix * vec4(position, 1.0);- vWorldDir = normalize(wp.xyz - cameraPosition);- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);-}-`;--const fragmentShader = /* glsl */ `-uniform vec3 uZenith;-uniform vec3 uHorizon;-uniform vec3 uSunDir;-uniform float uTime;-varying vec3 vWorldDir;-void main() {- float h = clamp(vWorldDir.y, -0.2, 1.0);- vec3 col = mix(uHorizon, uZenith, pow(max(h, 0.0), 0.55));- float sun = pow(max(dot(normalize(vWorldDir), normalize(uSunDir)), 0.0), 180.0);- col += vec3(1.0, 0.9, 0.7) * sun * 1.5;- // slow drifting haze band so the sky is visibly alive in update(t)- col += 0.04 * sin(vWorldDir.x * 6.0 + uTime * 0.15) * (1.0 - h);- gl_FragColor = vec4(col, 1.0);-}-`;--export function makeSkyMaterial(T = THREE) {- return new T.ShaderMaterial({- uniforms: {- uZenith: { value: new T.Color(0x3f74c9) },- uHorizon: { value: new T.Color(0xcfdcec) },- uSunDir: { value: new T.Vector3(-0.45, 0.6, -0.65) },- uTime: { value: 0 },- },- vertexShader,- fragmentShader,- side: T.BackSide,- depthWrite: false,- fog: false,- });-}diff --git a/harness/tests/scene_gates/test_live_frames.py b/harness/tests/scene_gates/test_live_frames.pyindex 971bcd4a..f0351070 100644--- a/harness/tests/scene_gates/test_live_frames.py+++ b/harness/tests/scene_gates/test_live_frames.py@@ -40,9 +40,6 @@ def _darken(ws: Workspace) -> None:text = text.replace("scene.background = new THREE.Color(shell.fog.color)", "scene.background = new THREE.Color(0x000000)")assert "0.05" in text and text.count("0x000000") >= 4env.write_text(text)- sky = ws.src / "shaders" / "sky.js"- if sky.is_file():- sky.write_text(sky.read_text().replace("export function", "export function /*dark*/"))def test_example_scene_passes_frame_gate_and_judge_subset(starter_ws: Workspace):diff --git a/harness/tests/scene_runtime/test_runtime.py b/harness/tests/scene_runtime/test_runtime.pyindex 68d42e7c..06801d69 100644--- a/harness/tests/scene_runtime/test_runtime.py+++ b/harness/tests/scene_runtime/test_runtime.py@@ -43,7 +43,7 @@ def test_build_ok_on_example(starter_ws):@needs_browserdef test_build_fails_with_file_line_on_shader_error(starter_ws):# the pond's water shader: a file the example scene compiles (the starter's sky comes- # from lib/environment.js worldShell since D71, so shaders/sky.js is no longer loaded)+ # from lib/environment.js worldShell since D71)p = starter_ws.src / "shaders" / "water.js"text = p.read_text().replace("float fres = pow(1.0 - max(dot(N, V), 0.0), 3.0);", "float fres = pow(1.0 - max(dot(N, V), 0.0), 3.0) + nope;")assert "nope" in textdiff --git a/harness/tests/scene_runtime/test_skeleton.py b/harness/tests/scene_runtime/test_skeleton.pyindex 767abd48..2debe91c 100644--- a/harness/tests/scene_runtime/test_skeleton.py+++ b/harness/tests/scene_runtime/test_skeleton.py@@ -27,7 +27,7 @@ def make_plan() -> ScenePlan:def test_example_files_exist_and_are_complete():names = {p.relative_to(STARTER_DIR).as_posix() for p in STARTER_DIR.rglob("*.js")}- assert {"scene.js", "env.js", "zones/meadow.js", "zones/pondside.js", "assets/pine_tree.js", "assets/windmill.js", "shaders/water.js", "shaders/sky.js"} <= names+ assert {"scene.js", "env.js", "zones/meadow.js", "zones/pondside.js", "assets/pine_tree.js", "assets/windmill.js", "shaders/water.js"} <= namesscene = (STARTER_DIR / "scene.js").read_text()assert "export function createScene" in scene and "cameras" in scene and "update(t, dt)" in sceneassert "ShaderMaterial" in (STARTER_DIR / "shaders" / "water.js").read_text()@@ -165,7 +165,7 @@ def test_every_call_the_catalog_advertises_is_a_real_export():catalog = (PROMPTS_DIR / "scene_threejs" / "effects_catalog.md").read_text()# option names and prose words that appear in backticks but name no exportprose = {"js", "true", "false", "material", "scene", "g", "t", "dt", "update", "tick",- "logarithmicDepthBuffer", "sunDir", "ambient", "elevation", "keyElevation", "color"}+ "logarithmicDepthBuffer", "sunDir", "ambient", "elevation", "color"}unknown, named = [], set()for row in catalog.splitlines():if not row.startswith("|") or row.startswith(("| ---", "| Want")):