You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a9ed552
Browse filesBrowse the repository at this point in the historyBrowse files
Light3d: take a Vector3d for direction and position (melonjs#1663)
Both were `[number, number, number]` read by index, so a `Vector3d` — the
obvious thing to reach for when an option is named `direction` in a 3D engine —
set all three components to `undefined`, `normalize()` kept them `NaN`, and the
light contributed nothing. Silently: no warning, and the scene still renders
with whatever else is lit.
`color` on the same options object already accepts a `Color`, a CSS string or
an array, so this makes the object consistent with itself rather than adding a
new idea. The value is READ, not retained — the light keeps its own normalized
vector, and moving yours afterwards does not steer it.
Additive: widening the union leaves every array call compiling and on the
identical path. The only behaviour that changes is passing a `Vector3d`, which
produced no light at all.
Three shipped examples got this wrong, which is why it is worth the branch.
Closesmelonjs#1661
Claude-Session: https://claude.ai/code/session_01NGvtaUNATVCVxD2qcbiY4t
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Copy file name to clipboardExpand all lines: packages/melonjs/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,8 @@
9
9
-`save`: registered keys are reachable from TypeScript without a cast. The namespace was typed `Record<string, unknown>`, and that index signature swallowed its own members, so under `strict``save.add()` was `unknown` and could not be called at all. `add()` now returns the namespace typed with the keys just registered, and chained calls accumulate
10
10
-`audio.tone()` and `audio.noise()` take a `delay` in seconds, scheduled on the audio clock, so a multi-part sound — a stinger's second note, an explosion's double-tap — sequences without a `setTimeout`. A timer fires on the main thread and a busy frame slips the note; this is scheduled up front and is sample-accurate. Omitting it is unchanged
11
11
12
+
-`Light3d`: `direction` and `position` accept a `Vector3d` as well as an `[x, y, z]` array, so a value the game already holds goes straight in — `color` already took a `Color`, a string or an array. The vector is read, not retained. Passing one used to be read by index and silently produce a `NaN` direction, so the light contributed nothing ([#1661](https://github.com/melonjs/melonJS/issues/1661))
13
+
12
14
### Fixed
13
15
- Renderable: opacity now cascades — `alpha` multiplies with the alpha already on the renderer instead of replacing it, so a child at 0.5 inside a parent at 0.5 draws at 0.25. **A nested renderable that was visibly opaque under a faded ancestor will now fade with it**
14
16
- GLTFModel: a loaded model reported no bounds at all, so a model with a `Body` was filed in the broadphase away from where it stood and collided with nothing. Its extent now comes from the glTF bounding box, measured once at load
0 commit comments