Skip to content

docs(light): tighten LightComponent JSDoc#8667

Merged
willeastcott merged 13 commits into
mainfrom
docs/light-component-jsdoc
May 3, 2026
Merged

docs(light): tighten LightComponent JSDoc#8667
willeastcott merged 13 commits into
mainfrom
docs/light-component-jsdoc

Conversation

@willeastcott

@willeastcott willeastcott commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Comprehensive JSDoc pass over the public LightComponent API. No runtime changes.

Factual fixes

  • cookieFalloff default corrected from false to true to match Light._cookieFalloff = true.
  • affectSpecularity description updated to reflect the new behaviour from refactor(light): align LightComponent with CameraComponent architecture #8666: the value is now preserved on the component and re-applied if the type later becomes directional (rather than silently dropped for non-directional types).
  • bakeArea getter description was a stale "Gets the penumbra angle in degrees." — replaced with a description matching the rewritten setter.
  • cookieAsset getter description implied an Asset instance was returned — corrected to match the actual {number|null} return type (the asset id, or null).
  • Class-level example link typo: Clustered Onmi ShadowsClustered Omni Shadows.
  • Missing close paren in the SHADOWUPDATE_THISFRAME bullet.
  • shadow update modelshadow update mode (twice).
  • shadowBlockerSamples: this valuesthis value.

Defaults added to setter docs

shadowType, vsmBlurMode, vsmBias, cookieAsset, cookie, cookieChannel, cookieAngle, cookieScale, cookieOffset, mask (now linked to MASK_AFFECT_DYNAMIC), affectDynamic, affectLightmapped, bake, bakeDir, isStatic, layers, shadowUpdateOverrides.

Style / consistency

  • Drop pc. prefix on pc.LIGHTSHAPE_PUNCTUAL and switch to {@link LIGHTSHAPE_PUNCTUAL} to match every other constant reference in the file.
  • Unify Defaults to N. phrasing.
  • type setter bullets reworded to mirror the class-level type descriptions (the previous "spot" line — "an omni-directional light but is bounded by a cone" — was self-contradictory).
  • Property cross-references in the affectSpecularity / bakeArea / bakeDir setter docs use {@link …} for type, bake and bakeDir instead of bare backticks.
  • affectSpecularity and bakeArea setter docs refer to the public string "directional" rather than the internal LIGHTTYPE_DIRECTIONAL numeric constant (the public LightComponent#type is string-based).
  • cookieAsset setter description simplified to document the public contract (an asset id) without advertising the legacy Asset-instance shim.
  • color setter notes that the value is in sRGB space.
  • shadowUpdateOverrides: Set to undefined if not used.Set to null if not used. (matches the actual default), and {number[] | null}{number[]|null} to match the engine's no-spaces JSDoc convention.

Clarity rewrites

  • bakeArea rewritten — the previous description called it a "penumbra angle"; it actually controls the angular size used when baking soft shadow boundaries for a directional light into the lightmap.
  • mask description expanded to explain bit composition and to spell out that the affectDynamic / affectLightmapped / bake helpers are backed by independent state and are not recomputed from mask (so writing mask directly will not update those getters, and a subsequent helper write may overwrite bits set via mask).
  • shadowSamples: must be a positive whole numbershould be a positive whole number (the setter does not validate).
  • cookie / cookieAsset: clarify that spot lights expect a 2D texture and omni lights a cubemap.
  • bakeDir: minor grammar pass.
  • vsmBlurSize: Only uneven numbers work, even are incremented.Only odd values are supported; even values are rounded up to the next odd value.

Public API changes

None. Doc-comment-only.

Test plan

  • npm run lint clean.
  • npm run build:types succeeds.
  • npm run test:types succeeds (verifies the generated .d.ts).
  • No runtime tests required — JSDoc-only change.

Comprehensive pass over the LightComponent public API documentation:

Factual fixes
- cookieFalloff default corrected from `false` to `true`
- affectSpecularity description updated to reflect that the value is now
  preserved on the component and re-applied if the type later becomes
  directional (rather than being silently dropped for non-directional types)
- 'Onmi' typo in the class-level example link list
- Missing close paren in the SHADOWUPDATE_THISFRAME bullet
- 'shadow update model' -> 'shadow update mode'
- shadowBlockerSamples 'this values' -> 'this value'

Defaults added to setter docs
- shadowType, vsmBlurMode, vsmBias, cookieAsset, cookie, cookieChannel,
  cookieAngle, cookieScale, cookieOffset, mask, affectDynamic,
  affectLightmapped, bake, bakeDir, isStatic, layers, shadowUpdateOverrides

Style / consistency
- Drop `pc.` prefix on `pc.LIGHTSHAPE_PUNCTUAL` -> `{@link LIGHTSHAPE_PUNCTUAL}`
- Unify 'Defaults to N.' phrasing across the file
- type setter cross-links LIGHTTYPE_DIRECTIONAL/OMNI/SPOT and documents the
  'point' backwards-compat alias
- color setter notes sRGB color space
- shadowUpdateOverrides 'undefined' -> 'null' (matches the actual default)

Clarity rewrites
- bakeArea description rewritten to describe what it actually does
- mask description expanded to explain bit composition and helper interaction
- shadowSamples 'must be' -> 'should be' (setter does not validate)
- cookie / cookieAsset clarify spot wants a 2D texture and omni a cubemap
- bakeDir grammar pass
- vsmBlurSize 'uneven' -> 'odd; even values are rounded up to the next odd'

Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

JSDoc-only cleanup pass over the public LightComponent API to improve correctness and consistency (defaults, links, phrasing), without changing runtime behavior.

Changes:

  • Corrects/clarifies several property defaults and behaviors (e.g., cookieFalloff, shadowUpdateMode, affectSpecularity).
  • Improves cross-linking and wording consistency across the API docs (constants, “Defaults to …” phrasing, examples).
  • Expands explanations for a few more nuanced properties (e.g., mask, bakeArea, cookie texture expectations).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/framework/components/light/component.js Outdated
The setter accepts strings, not the numeric constants, so linking the LIGHTTYPE_DIRECTIONAL/OMNI/SPOT constants alongside the string aliases invited confusion about which form to pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
The 'point' value is still tolerated by the runtime for legacy data, but it was removed from the public API long ago and shouldn't be advertised in user-facing JSDoc.

Co-authored-by: Cursor <cursoragent@cursor.com>
The affectDynamic / affectLightmapped / bake helpers maintain their own
private backing fields and are not recomputed from mask. The previous
wording ("manipulate the same underlying mask") implied a bidirectional
view; spell out that writes are one-way and the helpers can overwrite
each other.

Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/framework/components/light/component.js Outdated
Comment thread src/framework/components/light/component.js Outdated
- Reword the type setter bullets to match the class-level descriptions
  (the previous "spot: an omni-directional light but is bounded by a
  cone" was self-contradictory).
- Replace the stale "Gets the penumbra angle in degrees" wording on the
  bakeArea getter with the same description used by the setter.

Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/framework/components/light/component.js Outdated
The getter returns `_cookieAssetId` (number|null) but the JSDoc still
read "Gets the texture asset…", which implied an Asset instance.

Co-authored-by: Cursor <cursoragent@cursor.com>
The public LightComponent#type setter takes strings ("directional",
"omni", "spot"), so referring to the internal numeric LIGHTTYPE_*
constants in user-facing setter docs was mixing the two APIs. Switch
both occurrences (affectSpecularity, bakeArea) to the string form.

Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/framework/components/light/component.js Outdated
`bake` and `bakeDir` are public properties of LightComponent and the
file already uses {@link bake} elsewhere (mask, affectLightmapped). Fix
the remaining stray backtick references in bakeArea and bakeDir for
consistency and to give readers a clickable link to the related
property.

Co-authored-by: Cursor <cursoragent@cursor.com>
`type` is a public property on LightComponent, so the prose mentions in
the affectSpecularity and bakeArea setter docs should use {@link type}
for consistency with the rest of the property cross-references.

Co-authored-by: Cursor <cursoragent@cursor.com>
Setting cookieAsset to an Asset instance still works but is a legacy
back-compat shim that we don't want to advertise to new callers. The
setter is documented as taking an asset id, matching the {number|null}
type annotation and the getter's return value.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/framework/components/light/component.js Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/framework/components/light/component.js
Comment thread src/framework/components/light/component.js
@willeastcott willeastcott merged commit 4c598ac into main May 3, 2026
12 checks passed
@willeastcott willeastcott deleted the docs/light-component-jsdoc branch May 3, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation related enhancement Request for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants