Skip to content

Addons: Improve JSDocs #30106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/jsm/animation/CCDIKSolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ class CCDIKHelper extends Object3D {

/**
* Updates IK bones visualization.
*
* @param {Boolean} force
*/
updateMatrixWorld( force ) {

Expand Down
22 changes: 20 additions & 2 deletions examples/jsm/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2255,6 +2255,9 @@ const ALPHA_MODES = {

/**
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material
*
* @param {Object<String, Material>} cache
* @return {Material}
*/
function createDefaultMaterial( cache ) {

Expand Down Expand Up @@ -2753,6 +2756,9 @@ class GLTFParser {
* Textures) can be reused directly and are not marked here.
*
* Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
*
* @param {Object} cache
* @param {Object3D} index
*/
_addNodeRef( cache, index ) {

Expand All @@ -2768,7 +2774,14 @@ class GLTFParser {

}

/** Returns a reference to a shared resource, cloning it if necessary. */
/**
* Returns a reference to a shared resource, cloning it if necessary.
*
* @param {Object} cache
* @param {Number} index
* @param {Object} object
* @return {Object}
*/
_getNodeRef( cache, index, object ) {

if ( cache.refs[ index ] <= 1 ) return object;
Expand Down Expand Up @@ -3653,7 +3666,12 @@ class GLTFParser {

}

/** When Object3D instances are targeted by animation, they need unique names. */
/**
* When Object3D instances are targeted by animation, they need unique names.
*
* @param {String} originalName
* @return {String}
*/
createUniqueName( originalName ) {

const sanitizedName = PropertyBinding.sanitizeNodeName( originalName || '' );
Expand Down
7 changes: 6 additions & 1 deletion examples/jsm/loaders/KTX2Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,12 @@ KTX2Loader.BasisWorker = function () {

}

/** Concatenates N byte arrays. */
/**
* Concatenates N byte arrays.
*
* @param {Uint8Array[]} arrays
* @return {Uint8Array}
*/
function concat( arrays ) {

if ( arrays.length === 1 ) return arrays[ 0 ];
Expand Down
17 changes: 17 additions & 0 deletions examples/jsm/math/OBB.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ class OBB {
/**
* Reference: Closest Point on OBB to Point in Real-Time Collision Detection
* by Christer Ericson (chapter 5.1.4)
*
* @param {Vector3} point
* @param {Vector3} result
* @returns {Vector3}
*/
clampPoint( point, result ) {

Expand Down Expand Up @@ -146,6 +150,9 @@ class OBB {
* Reference: OBB-OBB Intersection in Real-Time Collision Detection
* by Christer Ericson (chapter 4.4.1)
*
* @param {OBB} obb
* @param {Number} [epsilon=Number.EPSILON] - A small value to prevent arithmetic errors
* @returns {Boolean}
*/
intersectsOBB( obb, epsilon = Number.EPSILON ) {

Expand Down Expand Up @@ -285,6 +292,9 @@ class OBB {
/**
* Reference: Testing Box Against Plane in Real-Time Collision Detection
* by Christer Ericson (chapter 5.2.3)
*
* @param {Plane} plane
* @returns {Boolean}
*/
intersectsPlane( plane ) {

Expand All @@ -309,6 +319,10 @@ class OBB {
/**
* Performs a ray/OBB intersection test and stores the intersection point
* to the given 3D vector. If no intersection is detected, *null* is returned.
*
* @param {Ray} ray
* @param {Vector3} result
* @return {Vector3?}
*/
intersectRay( ray, result ) {

Expand Down Expand Up @@ -347,6 +361,9 @@ class OBB {
/**
* Performs a ray/OBB intersection test. Returns either true or false if
* there is a intersection or not.
*
* @param {Ray} ray
* @returns {Boolean}
*/
intersectsRay( ray ) {

Expand Down
5 changes: 5 additions & 0 deletions examples/jsm/webxr/XRControllerModelFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class XRControllerModel extends Object3D {
/**
* Polls data from the XRInputSource and updates the model's components to match
* the real world data
*
* @param {Boolean} force
*/
updateMatrixWorld( force ) {

Expand Down Expand Up @@ -109,6 +111,9 @@ class XRControllerModel extends Object3D {
* Walks the model's tree to find the nodes needed to animate the components and
* saves them to the motionController components for use in the frame loop. When
* touchpads are found, attaches a touch dot to them.
*
* @param {MotionController} motionController
* @param {Object3D} scene
*/
function findNodes( motionController, scene ) {

Expand Down
Loading