Skip to content

Fix StandardMaterial JSDoc property types and add missing entries - #9294

Merged
willeastcott merged 1 commit into
mainfrom
fix-standard-material-property-docs
Sep 3, 2026
Merged

Fix StandardMaterial JSDoc property types and add missing entries#9294
willeastcott merged 1 commit into
mainfrom
fix-standard-material-property-docs

Conversation

@willeastcott

Copy link
Copy Markdown
Contributor

Description

Fixes errors in the StandardMaterial class-level @property block. The typedoc plugin turns this block into the documented properties on api.playcanvas.com, so these mistakes are visible in the published API reference. JSDoc only; no runtime or API changes.

Type fixes

  • refractionVertexColorChannel was typed boolean. It is a channel string (default "g").
  • opacityShadowDither was typed boolean. It is a DITHER_* string constant (default DITHER_NONE), as its own description already lists.

Missing properties added

  • iridescence - the constant iridescence intensity. It is multiplied with iridescenceMap, and it gates the layer: useIridescence alone does nothing while iridescence is 0.
  • sheenVertexColorChannel
  • thicknessVertexColorChannel

Description fixes

  • diffuseDetailMapRotation described itself as the main map rather than the detail map.
  • refractionMapRotation said "emissive map".
  • iridescenceThicknessMapRotation said "iridescence map".
  • sheenGlossMapUv said "Sheen map".
  • useMetalnessSpecularColor ended in a dangling fragment: "at direct angles."

Deliberately left undocumented
iridescenceVertexColor, iridescenceVertexColorChannel, iridescenceThicknessVertexColor and iridescenceThicknessVertexColorChannel exist on the material because _defineTex2D creates vertex color accessors by default, but neither the GLSL nor the WGSL iridescence / iridescenceThickness chunks read the STD_*_VERTEX define, so they have no effect. They should either be wired up in the chunks (as metalness and thickness are) or created with vertexColor = false. Either is a behaviour change, so it is left for a follow-up rather than documenting inert properties here.

Verified with npm run lint, npm run docs, and npm run build:types && npm run test:types.

Checklist

  • I have read the contributing guidelines
  • My code follows the project's coding standards
  • This PR focuses on a single change

🤖 Generated with Claude Code

- Type refractionVertexColorChannel and opacityShadowDither as string
- Document iridescence, sheenVertexColorChannel and thicknessVertexColorChannel
- Fix copy-paste slips in diffuseDetailMapRotation, refractionMapRotation,
  iridescenceThicknessMapRotation, sheenGlossMapUv and useMetalnessSpecularColor

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.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.

🟢 Approval recommended

The diff is limited to JSDoc corrections/additions that align with existing StandardMaterial properties and defaults, with no runtime changes introduced.

Pull request overview

This PR corrects the class-level JSDoc @property block for StandardMaterial so the generated API documentation (api.playcanvas.com) reflects the actual material properties and their intended types/semantics, without changing runtime behavior.

Changes:

  • Fixes incorrect JSDoc types (notably refractionVertexColorChannel and opacityShadowDither) to match the actual values used by the engine.
  • Adds missing documented properties that already exist on StandardMaterial (e.g. iridescence, sheenVertexColorChannel, thicknessVertexColorChannel).
  • Corrects several property descriptions/wording issues in map rotation and UV entries.
File summaries
File Description
src/scene/materials/standard-material.js Updates StandardMaterial’s class-level JSDoc @property list to correct types, add missing entries, and fix misleading descriptions used by the API docs generator.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Public API report

This PR changes the public API surface (+5 / −2), per the docs' rules (@ignore / @Private / undocumented are excluded).

Show API diff
+StandardMaterial.iridescence: number
-StandardMaterial.opacityShadowDither: boolean
+StandardMaterial.opacityShadowDither: string
-StandardMaterial.refractionVertexColorChannel: boolean
+StandardMaterial.refractionVertexColorChannel: string
+StandardMaterial.sheenVertexColorChannel: string
+StandardMaterial.thicknessVertexColorChannel: string

Informational only — this never fails the build.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Build size report

This PR does not change the size of the minified bundles.

Bundle Minified Gzip Brotli
playcanvas.min.js 2407.4 KB — 620.0 KB — 481.4 KB —
playcanvas.min.mjs 2404.7 KB — 618.7 KB — 480.4 KB —

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants