Skip to content

Commit e378645

Browse files
authored
More incremental improvements to JSDocs (#7619)
1 parent 5097e23 commit e378645

File tree

9 files changed

+37
-28
lines changed

9 files changed

+37
-28
lines changed

src/core/shape/tri.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const q = new Vec3();
1414
const EPSILON = 1e-6;
1515

1616
/**
17-
* A triangle.
17+
* A triangle defined by three {@link Vec3} vectors.
1818
*
1919
* @category Math
2020
*/

src/core/tags.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { EventHandler } from './event-handler.js';
22

33
/**
4-
* Set of tag names. Tags are automatically available on {@link Entity} and {@link Asset} as `tags`
5-
* field.
4+
* Tags is a powerful tag management system for categorizing and filtering objects in PlayCanvas
5+
* applications. It provides an efficient way to attach string identifiers to objects and query them
6+
* using logical operations.
7+
*
8+
* Tags are automatically available on {@link Asset}s and {@link Entity}s (see {@link Asset#tags}
9+
* and {@link GraphNode#tags}). You can search for specific assets via {@link AssetRegistry#findByTag}
10+
* and specific entities via {@link GraphNode#findByTag}.
611
*/
712
class Tags extends EventHandler {
813
/**

src/extras/render-passes/camera-frame.js

+8-16
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ import { CameraFrameOptions, RenderPassCameraFrame } from './render-pass-camera-
1111
*/
1212

1313
/**
14+
* @typedef {Object} Rendering
1415
* Properties related to scene rendering, encompassing settings that control the rendering resolution,
1516
* pixel format, multi-sampling for anti-aliasing, tone-mapping and similar.
16-
*
17-
* @typedef {Object} Rendering
1817
* @property {number[]} renderFormats - The preferred render formats of the frame buffer, in order of
1918
* preference. First format from this list that is supported by the hardware is used. When none of
2019
* the formats are supported, {@link PIXELFORMAT_RGBA8} is used, but this automatically disables
@@ -52,12 +51,11 @@ import { CameraFrameOptions, RenderPassCameraFrame } from './render-pass-camera-
5251
*/
5352

5453
/**
54+
* @typedef {Object} Ssao
5555
* Properties related to the Screen Space Ambient Occlusion (SSAO) effect, a postprocessing technique
5656
* that approximates ambient occlusion by calculating how exposed each point in the screen space is
5757
* to ambient light, enhancing depth perception and adding subtle shadowing in crevices and between
5858
* objects.
59-
*
60-
* @typedef {Object} Ssao
6159
* @property {string} type - The type of the SSAO determines how it is applied in the rendering
6260
* process. Defaults to {@link SSAOTYPE_NONE}. Can be:
6361
*
@@ -77,11 +75,10 @@ import { CameraFrameOptions, RenderPassCameraFrame } from './render-pass-camera-
7775
*/
7876

7977
/**
78+
* @typedef {Object} Bloom
8079
* Properties related to the HDR bloom effect, a postprocessing technique that simulates the natural
8180
* glow of bright light sources by spreading their intensity beyond their boundaries, creating a soft
8281
* and realistic blooming effect.
83-
*
84-
* @typedef {Object} Bloom
8582
* @property {number} intensity - The intensity of the bloom effect, 0-0.1 range. Defaults to 0,
8683
* making it disabled.
8784
* @property {number} blurLevel - The number of iterations for blurring the bloom effect, with each
@@ -90,11 +87,10 @@ import { CameraFrameOptions, RenderPassCameraFrame } from './render-pass-camera-
9087
*/
9188

9289
/**
90+
* @typedef {Object} Grading
9391
* Properties related to the color grading effect, a postprocessing technique used to adjust and the
9492
* visual tone of an image. This effect modifies brightness, contrast, saturation, and overall color
9593
* balance to achieve a specific aesthetic or mood.
96-
*
97-
* @typedef {Object} Grading
9894
* @property {boolean} enabled - Whether grading is enabled. Defaults to false.
9995
* @property {number} brightness - The brightness of the grading effect, 0-3 range. Defaults to 1.
10096
* @property {number} contrast - The contrast of the grading effect, 0.5-1.5 range. Defaults to 1.
@@ -103,12 +99,11 @@ import { CameraFrameOptions, RenderPassCameraFrame } from './render-pass-camera-
10399
*/
104100

105101
/**
102+
* @typedef {Object} Vignette
106103
* Properties related to the vignette effect, a postprocessing technique that darkens the image
107104
* edges, creating a gradual falloff in brightness from the center outward. The effect can be also
108105
* reversed, making the center of the image darker than the edges, by specifying the outer distance
109106
* smaller than the inner distance.
110-
*
111-
* @typedef {Object} Vignette
112107
* @property {number} intensity - The intensity of the vignette effect, 0-1 range. Defaults to 0,
113108
* making it disabled.
114109
* @property {number} inner - The inner distance of the vignette effect measured from the center of
@@ -126,19 +121,17 @@ import { CameraFrameOptions, RenderPassCameraFrame } from './render-pass-camera-
126121
*/
127122

128123
/**
124+
* @typedef {Object} Fringing
129125
* Properties related to the fringing effect, a chromatic aberration phenomenon where the red, green,
130126
* and blue color channels diverge increasingly with greater distance from the center of the screen.
131-
*
132-
* @typedef {Object} Fringing
133127
* @property {number} intensity - The intensity of the fringing effect, 0-100 range. Defaults to 0,
134128
* making it disabled.
135129
*/
136130

137131
/**
132+
* @typedef {Object} Taa
138133
* Properties related to temporal anti-aliasing (TAA), which is a technique used to reduce aliasing
139134
* in the rendered image by blending multiple frames together over time.
140-
*
141-
* @typedef {Object} Taa
142135
* @property {boolean} enabled - Whether TAA is enabled. Defaults to false.
143136
* @property {number} jitter - The intensity of the camera jitter, 0-1 range. The larger the value,
144137
* the more jitter is applied to the camera, making the anti-aliasing effect more pronounced. This
@@ -147,11 +140,10 @@ import { CameraFrameOptions, RenderPassCameraFrame } from './render-pass-camera-
147140
*/
148141

149142
/**
143+
* @typedef {Object} Dof
150144
* Properties related to Depth of Field (DOF), a technique used to simulate the optical effect where
151145
* objects at certain distances appear sharp while others are blurred, enhancing the perception of
152146
* focus and depth in the rendered scene.
153-
*
154-
* @typedef {Object} Dof
155147
* @property {boolean} enabled - Whether DoF is enabled. Defaults to false.
156148
* @property {boolean} nearBlur - Whether the near blur is enabled. Defaults to false.
157149
* @property {number} focusDistance - The distance at which the focus is set. Defaults to 100.

src/framework/components/scrollbar/data.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ScrollbarComponentData {
1414
/** @type {number} */
1515
handleSize = 0;
1616

17-
/** @type {Entity} */
17+
/** @type {Entity|null} */
1818
handleEntity = null;
1919
}
2020

src/framework/components/sound/slot.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ const instanceOptions = {
3030
};
3131

3232
/**
33-
* The SoundSlot controls playback of an audio asset.
33+
* The SoundSlot controls playback of an audio asset. A {@link SoundComponent} can have multiple
34+
* slots that can be queried via {@link SoundComponent#slot}.
3435
*
3536
* @category Sound
3637
*/

src/framework/components/sound/system.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class SoundComponentSystem extends ComponentSystem {
4949

5050
/**
5151
* Sets the volume for the entire Sound system. All sounds will have their volume multiplied by
52-
* this value. Valid between [0, 1].
52+
* this value. Valid range is between 0 and 1. Defaults to 1.
5353
*
5454
* @type {number}
5555
*/

src/framework/xr/xr-manager.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,20 @@ import { XrViews } from './xr-views.js';
3030

3131
/**
3232
* @callback XrRoomCaptureCallback
33-
* Callback used by manual room capturing.
33+
* Callback used by {@link XrManager#initiateRoomCapture}.
3434
* @param {Error|null} err - The Error object or null if manual room capture was successful.
3535
* @returns {void}
3636
*/
3737

3838
/**
39-
* Manage and update XR session and its states.
39+
* XrManager provides a comprehensive interface for WebXR integration in PlayCanvas applications.
40+
* It manages the full lifecycle of XR sessions (VR/AR), handles device capabilities, and provides
41+
* access to various XR features through specialized subsystems.
42+
*
43+
* In order for XR to be available, ensure that your application is served over HTTPS or localhost.
44+
*
45+
* The {@link AppBase} class automatically creates an instance of this class and makes it available
46+
* as {@link AppBase#xr}.
4047
*
4148
* @category XR
4249
*/
@@ -229,7 +236,7 @@ class XrManager extends EventHandler {
229236
anchors;
230237

231238
/**
232-
* @type {CameraComponent}
239+
* @type {CameraComponent|null}
233240
* @private
234241
*/
235242
_camera = null;
@@ -337,6 +344,9 @@ class XrManager extends EventHandler {
337344
* callback when session is created or failed to create. Integrated XR APIs need to be enabled
338345
* by providing relevant options.
339346
*
347+
* Note that the start method needs to be called in response to user action, such as a button
348+
* click. It will not work if called in response to a timer or other event.
349+
*
340350
* @param {CameraComponent} camera - It will be used to render XR session and manipulated based
341351
* on pose tracking.
342352
* @param {string} type - Session type. Can be one of the following:

src/platform/sound/sound.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/**
2-
* Represents the resource of an audio asset.
2+
* Represents the raw audio data of playable sound. A Sound is the resource of an audio
3+
* {@link Asset}. An audio asset can be assigned to a {@link SoundSlot} owned by a
4+
* {@link SoundComponent}.
35
*
46
* @category Sound
57
*/

src/scene/materials/standard-material.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ let _params = new Set();
4141
const _tempColor = new Color();
4242

4343
/**
44-
* Callback used by {@link StandardMaterial#onUpdateShader}.
45-
*
4644
* @callback UpdateShaderCallback
45+
* Callback used by {@link StandardMaterial#onUpdateShader}.
4746
* @param {StandardMaterialOptions} options - An object with shader generator settings (based on current
4847
* material and scene properties), that you can change and then return. Properties of the object passed
4948
* into this function are documented in {@link StandardMaterial}. Also contains a member named litOptions

0 commit comments

Comments
 (0)