Fix StandardMaterial JSDoc property types and add missing entries - #9294
Conversation
- 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>
There was a problem hiding this comment.
🟢 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
refractionVertexColorChannelandopacityShadowDither) 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.
Public API reportThis 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: stringInformational only — this never fails the build. |
Build size reportThis PR does not change the size of the minified bundles.
|
Description
Fixes errors in the
StandardMaterialclass-level@propertyblock. 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
refractionVertexColorChannelwas typedboolean. It is a channel string (default"g").opacityShadowDitherwas typedboolean. It is aDITHER_*string constant (defaultDITHER_NONE), as its own description already lists.Missing properties added
iridescence- the constant iridescence intensity. It is multiplied withiridescenceMap, and it gates the layer:useIridescencealone does nothing whileiridescenceis 0.sheenVertexColorChannelthicknessVertexColorChannelDescription fixes
diffuseDetailMapRotationdescribed itself as the main map rather than the detail map.refractionMapRotationsaid "emissive map".iridescenceThicknessMapRotationsaid "iridescence map".sheenGlossMapUvsaid "Sheen map".useMetalnessSpecularColorended in a dangling fragment: "at direct angles."Deliberately left undocumented
iridescenceVertexColor,iridescenceVertexColorChannel,iridescenceThicknessVertexColorandiridescenceThicknessVertexColorChannelexist on the material because_defineTex2Dcreates vertex color accessors by default, but neither the GLSL nor the WGSLiridescence/iridescenceThicknesschunks read theSTD_*_VERTEXdefine, so they have no effect. They should either be wired up in the chunks (asmetalnessandthicknessare) or created withvertexColor = 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, andnpm run build:types && npm run test:types.Checklist
🤖 Generated with Claude Code