spoint 0.1.688 → 0.1.689
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/apps/world/tps-game.js +8 -5
- package/client/core/TimeOfDay.js +15 -1
- package/package.json +1 -1
package/apps/world/tps-game.js
CHANGED
|
@@ -18,14 +18,17 @@ const TERRAIN = {
|
|
|
18
18
|
// they stay a single source of truth. Singleplayer (WorkerEntry.js's in-Worker boot of this same world
|
|
19
19
|
// def) also reads serverAuthoritative, but with no other client to sync to it's a no-op there in
|
|
20
20
|
// practice -- the local clock behaves identically to before this feature.
|
|
21
|
-
// AAA-push cross-piece regression (found live, round 5 of the open-landscape piece): startFraction
|
|
21
|
+
// AAA-push cross-piece regression (found live, round 5-7 of the open-landscape piece): startFraction
|
|
22
22
|
// was bumped 0.3->0.27 by the low-sun/golden-hour piece's own round 3 so the world would boot AT
|
|
23
23
|
// that piece's target lighting for easy iteration -- but this is the WORLD'S shared default time,
|
|
24
24
|
// so every OTHER piece (open-landscape-midday included) got tested against golden-hour lighting by
|
|
25
|
-
// accident
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
|
|
25
|
+
// accident. Reverting to 0.3 wasn't actually a fix either: client/core/TimeOfDay.js's own
|
|
26
|
+
// _elevationDeg(frac)=sin((frac-0.25)*2pi)*(90-tilt) peaks at frac=0.5 (true solar noon) -- 0.3 is
|
|
27
|
+
// only ~18deg elevation (its own comment even says "0.3 ~ mid-morning", never claimed to be
|
|
28
|
+
// midday). Using 0.5 for genuine midday/high-sun testing; per-piece lighting states still belong
|
|
29
|
+
// in each piece's own test setup for pieces that need a DIFFERENT angle (e.g. low-sun), never in
|
|
30
|
+
// this shared world config that every piece's test otherwise inherits.
|
|
31
|
+
timeOfDay: { serverAuthoritative: true, dayLengthSec: 600, startFraction: 0.5 },
|
|
29
32
|
// weather-server-driven-state-and-multiplayer-sync: same real-multiplayer-test-world rationale as
|
|
30
33
|
// timeOfDay.serverAuthoritative immediately above -- every connected client's weather state
|
|
31
34
|
// (client/core/Weather.js) stays a server-pushed value (src/sdk/ServerWeather.js, MSG.WEATHER_SYNC)
|
package/client/core/TimeOfDay.js
CHANGED
|
@@ -111,7 +111,21 @@ export function createTimeOfDay(sun, ambient, opts = {}) {
|
|
|
111
111
|
}
|
|
112
112
|
const elevDeg = _elevationDeg(t)
|
|
113
113
|
const kf = _lerpKeyframes(elevDeg)
|
|
114
|
-
|
|
114
|
+
// BUG FOUND LIVE (AAA-push, startFraction changes had zero visible effect on the rendered sky/
|
|
115
|
+
// sun despite window.__timeOfDay.elevationDeg correctly reporting the new angle): this function
|
|
116
|
+
// updated sun.color/sun.intensity from the day-cycle every frame but never sun.position -- the
|
|
117
|
+
// DirectionalLight's direction stayed frozen at whatever the static world-config set once at
|
|
118
|
+
// boot, forever, regardless of the day cycle. onDirectionChange(dir) only fed the shadow-camera
|
|
119
|
+
// offset and the terrain sky-shader's local sun dir, neither of which is the visible THREE.js
|
|
120
|
+
// sun light object itself. A DirectionalLight's direction is FROM position TOWARD target (both
|
|
121
|
+
// default at the origin unless target is parented into the scene), so position the light along
|
|
122
|
+
// `dir` at a fixed distance to preserve the same effective direction the rest of the pipeline
|
|
123
|
+
// already computes from `dir`.
|
|
124
|
+
if (sun) {
|
|
125
|
+
sun.color.setHex(kf.sunColor); sun.intensity = kf.sunIntensity
|
|
126
|
+
const SUN_DIST = 200
|
|
127
|
+
sun.position.set(dir[0] * SUN_DIST, dir[1] * SUN_DIST, dir[2] * SUN_DIST)
|
|
128
|
+
}
|
|
115
129
|
if (ambient) { ambient.color.setHex(kf.ambientColor); ambient.intensity = kf.ambientIntensity }
|
|
116
130
|
if (typeof window !== 'undefined') {
|
|
117
131
|
window.__timeOfDay = window.__timeOfDay || {}
|