From 2a6c075be6938818a40f31267f240d4effbb696b Mon Sep 17 00:00:00 2001 From: Martin Valigursky <59932779+mvaligursky@users.noreply.github.com> Date: Wed, 24 Apr 2024 16:25:56 +0100 Subject: [PATCH] Fixes to Geometry classes JSDocs (#6282) Co-authored-by: Martin Valigursky --- src/scene/geometry/box-geometry.js | 30 +++++++++++++------------ src/scene/geometry/capsule-geometry.js | 26 +++++++++++---------- src/scene/geometry/cone-geometry.js | 24 +++++++++++--------- src/scene/geometry/cylinder-geometry.js | 24 +++++++++++--------- src/scene/geometry/dome-geometry.js | 16 +++++++------ src/scene/geometry/plane-geometry.js | 22 +++++++++--------- src/scene/geometry/sphere-geometry.js | 20 +++++++++-------- src/scene/geometry/torus-geometry.js | 30 +++++++++++++------------ 8 files changed, 104 insertions(+), 88 deletions(-) diff --git a/src/scene/geometry/box-geometry.js b/src/scene/geometry/box-geometry.js index 8d743b4ffbe..5ac264f116b 100644 --- a/src/scene/geometry/box-geometry.js +++ b/src/scene/geometry/box-geometry.js @@ -14,23 +14,25 @@ const primitiveUv1PaddingScale = 1.0 - primitiveUv1Padding * 2; * * Note that the box is created with UVs in the range of 0 to 1 on each face. * - * @param {import('../../platform/graphics/graphics-device.js').GraphicsDevice} device - The graphics - * device used to manage the mesh. - * @param {object} [opts] - An object that specifies optional inputs for the function as follows: - * @param {Vec3} [opts.halfExtents] - The half dimensions of the box in each axis (defaults to - * [0.5, 0.5, 0.5]). - * @param {number} [opts.widthSegments] - The number of divisions along the X axis of the box - * (defaults to 1). - * @param {number} [opts.lengthSegments] - The number of divisions along the Z axis of the box - * (defaults to 1). - * @param {number} [opts.heightSegments] - The number of divisions along the Y axis of the box - * (defaults to 1). - * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). - * @param {number} [opts.yOffset] - Move the box vertically by given offset in local space. Pass - * 0.5 to generate the box with pivot point at the bottom face. Defaults to 0. * @category Graphics */ class BoxGeometry extends Geometry { + /** + * Create a new BoxGeometry instance. + * + * @param {object} [opts] - An object that specifies optional inputs for the function as follows: + * @param {Vec3} [opts.halfExtents] - The half dimensions of the box in each axis (defaults to + * [0.5, 0.5, 0.5]). + * @param {number} [opts.widthSegments] - The number of divisions along the X axis of the box + * (defaults to 1). + * @param {number} [opts.lengthSegments] - The number of divisions along the Z axis of the box + * (defaults to 1). + * @param {number} [opts.heightSegments] - The number of divisions along the Y axis of the box + * (defaults to 1). + * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). + * @param {number} [opts.yOffset] - Move the box vertically by given offset in local space. Pass + * 0.5 to generate the box with pivot point at the bottom face. Defaults to 0. + */ constructor(opts = {}) { super(); diff --git a/src/scene/geometry/capsule-geometry.js b/src/scene/geometry/capsule-geometry.js index 41a59ee418d..c3717d6f8ed 100644 --- a/src/scene/geometry/capsule-geometry.js +++ b/src/scene/geometry/capsule-geometry.js @@ -10,21 +10,23 @@ import { calculateTangents } from './geometry-utils.js'; * * Note that the capsule is created with UVs in the range of 0 to 1. * - * @param {import('../../platform/graphics/graphics-device.js').GraphicsDevice} device - The graphics - * device used to manage the mesh. - * @param {object} [opts] - An object that specifies optional inputs for the function as follows: - * @param {number} [opts.radius] - The radius of the tube forming the body of the capsule (defaults - * to 0.3). - * @param {number} [opts.height] - The length of the body of the capsule from tip to tip (defaults - * to 1.0). - * @param {number} [opts.heightSegments] - The number of divisions along the tubular length of the - * capsule (defaults to 1). - * @param {number} [opts.sides] - The number of divisions around the tubular body of the capsule - * (defaults to 20). - * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). * @category Graphics */ class CapsuleGeometry extends ConeBaseGeometry { + /** + * Create a new CapsuleGeometry instance. + * + * @param {object} [opts] - An object that specifies optional inputs for the function as follows: + * @param {number} [opts.radius] - The radius of the tube forming the body of the capsule (defaults + * to 0.3). + * @param {number} [opts.height] - The length of the body of the capsule from tip to tip (defaults + * to 1.0). + * @param {number} [opts.heightSegments] - The number of divisions along the tubular length of the + * capsule (defaults to 1). + * @param {number} [opts.sides] - The number of divisions around the tubular body of the capsule + * (defaults to 20). + * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). + */ constructor(opts = {}) { // Check the supplied options and provide defaults for unspecified ones diff --git a/src/scene/geometry/cone-geometry.js b/src/scene/geometry/cone-geometry.js index a1410112bf6..a55f492c15d 100644 --- a/src/scene/geometry/cone-geometry.js +++ b/src/scene/geometry/cone-geometry.js @@ -10,20 +10,22 @@ import { calculateTangents } from './geometry-utils.js'; * * Note that the cone is created with UVs in the range of 0 to 1. * - * @param {import('../../platform/graphics/graphics-device.js').GraphicsDevice} device - The graphics - * device used to manage the mesh. - * @param {object} [opts] - An object that specifies optional inputs for the function as follows: - * @param {number} [opts.baseRadius] - The base radius of the cone (defaults to 0.5). - * @param {number} [opts.peakRadius] - The peak radius of the cone (defaults to 0.0). - * @param {number} [opts.height] - The length of the body of the cone (defaults to 1.0). - * @param {number} [opts.heightSegments] - The number of divisions along the length of the cone - * (defaults to 5). - * @param {number} [opts.capSegments] - The number of divisions around the tubular body of the cone - * (defaults to 18). - * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). * @category Graphics */ class ConeGeometry extends ConeBaseGeometry { + /** + * Create a new ConeGeometry instance. + * + * @param {object} [opts] - An object that specifies optional inputs for the function as follows: + * @param {number} [opts.baseRadius] - The base radius of the cone (defaults to 0.5). + * @param {number} [opts.peakRadius] - The peak radius of the cone (defaults to 0.0). + * @param {number} [opts.height] - The length of the body of the cone (defaults to 1.0). + * @param {number} [opts.heightSegments] - The number of divisions along the length of the cone + * (defaults to 5). + * @param {number} [opts.capSegments] - The number of divisions around the tubular body of the cone + * (defaults to 18). + * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). + */ constructor(opts = {}) { // Check the supplied options and provide defaults for unspecified ones diff --git a/src/scene/geometry/cylinder-geometry.js b/src/scene/geometry/cylinder-geometry.js index 78d58606472..086d9c86240 100644 --- a/src/scene/geometry/cylinder-geometry.js +++ b/src/scene/geometry/cylinder-geometry.js @@ -10,20 +10,22 @@ import { calculateTangents } from './geometry-utils.js'; * * Note that the cylinder is created with UVs in the range of 0 to 1. * - * @param {import('../../platform/graphics/graphics-device.js').GraphicsDevice} device - The graphics - * device used to manage the mesh. - * @param {object} [opts] - An object that specifies optional inputs for the function as follows: - * @param {number} [opts.radius] - The radius of the tube forming the body of the cylinder - * (defaults to 0.5). - * @param {number} [opts.height] - The length of the body of the cylinder (defaults to 1.0). - * @param {number} [opts.heightSegments] - The number of divisions along the length of the cylinder - * (defaults to 5). - * @param {number} [opts.capSegments] - The number of divisions around the tubular body of the - * cylinder (defaults to 20). - * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). * @category Graphics */ class CylinderGeometry extends ConeBaseGeometry { + /** + * Create a new CylinderGeometry instance. + * + * @param {object} [opts] - An object that specifies optional inputs for the function as follows: + * @param {number} [opts.radius] - The radius of the tube forming the body of the cylinder + * (defaults to 0.5). + * @param {number} [opts.height] - The length of the body of the cylinder (defaults to 1.0). + * @param {number} [opts.heightSegments] - The number of divisions along the length of the cylinder + * (defaults to 5). + * @param {number} [opts.capSegments] - The number of divisions around the tubular body of the + * cylinder (defaults to 20). + * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). + */ constructor(opts = {}) { // Check the supplied options and provide defaults for unspecified ones diff --git a/src/scene/geometry/dome-geometry.js b/src/scene/geometry/dome-geometry.js index e1e382047bc..514f6fcd42f 100644 --- a/src/scene/geometry/dome-geometry.js +++ b/src/scene/geometry/dome-geometry.js @@ -8,16 +8,18 @@ import { SphereGeometry } from "./sphere-geometry.js"; * * Note that the dome is created with UVs in the range of 0 to 1. * - * @param {import('../../platform/graphics/graphics-device.js').GraphicsDevice} device - The graphics - * device used to manage the mesh. - * @param {object} [opts] - An object that specifies optional inputs for the function as follows: - * @param {number} [opts.latitudeBands] - The number of divisions along the latitudinal axis of the - * sphere (defaults to 16). - * @param {number} [opts.longitudeBands] - The number of divisions along the longitudinal axis of - * the sphere (defaults to 16). * @category Graphics */ class DomeGeometry extends SphereGeometry { + /** + * Create a new CylinderGeometry instance. + * + * @param {object} [opts] - An object that specifies optional inputs for the function as follows: + * @param {number} [opts.latitudeBands] - The number of divisions along the latitudinal axis of the + * sphere (defaults to 16). + * @param {number} [opts.longitudeBands] - The number of divisions along the longitudinal axis of + * the sphere (defaults to 16). + */ constructor(opts = {}) { // create a sphere geometry diff --git a/src/scene/geometry/plane-geometry.js b/src/scene/geometry/plane-geometry.js index 69a4ada446a..d4dbbf9396d 100644 --- a/src/scene/geometry/plane-geometry.js +++ b/src/scene/geometry/plane-geometry.js @@ -12,19 +12,21 @@ import { Geometry } from './geometry.js'; * * Note that the plane is created with UVs in the range of 0 to 1. * - * @param {import('../../platform/graphics/graphics-device.js').GraphicsDevice} device - The graphics - * device used to manage the mesh. - * @param {object} [opts] - An object that specifies optional inputs for the function as follows: - * @param {Vec2} [opts.halfExtents] - The half dimensions of the plane in the X and Z axes - * (defaults to [0.5, 0.5]). - * @param {number} [opts.widthSegments] - The number of divisions along the X axis of the plane - * (defaults to 5). - * @param {number} [opts.lengthSegments] - The number of divisions along the Z axis of the plane - * (defaults to 5). - * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). * @category Graphics */ class PlaneGeometry extends Geometry { + /** + * Create a new PlaneGeometry instance. + * + * @param {object} [opts] - An object that specifies optional inputs for the function as follows: + * @param {Vec2} [opts.halfExtents] - The half dimensions of the plane in the X and Z axes + * (defaults to [0.5, 0.5]). + * @param {number} [opts.widthSegments] - The number of divisions along the X axis of the plane + * (defaults to 5). + * @param {number} [opts.lengthSegments] - The number of divisions along the Z axis of the plane + * (defaults to 5). + * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). + */ constructor(opts = {}) { super(); diff --git a/src/scene/geometry/sphere-geometry.js b/src/scene/geometry/sphere-geometry.js index 953194c2b6d..95e9a01d410 100644 --- a/src/scene/geometry/sphere-geometry.js +++ b/src/scene/geometry/sphere-geometry.js @@ -10,18 +10,20 @@ import { Geometry } from './geometry.js'; * * Note that the sphere is created with UVs in the range of 0 to 1. * - * @param {import('../../platform/graphics/graphics-device.js').GraphicsDevice} device - The graphics - * device used to manage the mesh. - * @param {object} [opts] - An object that specifies optional inputs for the function as follows: - * @param {number} [opts.radius] - The radius of the sphere (defaults to 0.5). - * @param {number} [opts.latitudeBands] - The number of divisions along the latitudinal axis of the - * sphere (defaults to 16). - * @param {number} [opts.longitudeBands] - The number of divisions along the longitudinal axis of - * the sphere (defaults to 16). - * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). * @category Graphics */ class SphereGeometry extends Geometry { + /** + * Create a new SphereGeometry instance. + * + * @param {object} [opts] - An object that specifies optional inputs for the function as follows: + * @param {number} [opts.radius] - The radius of the sphere (defaults to 0.5). + * @param {number} [opts.latitudeBands] - The number of divisions along the latitudinal axis of the + * sphere (defaults to 16). + * @param {number} [opts.longitudeBands] - The number of divisions along the longitudinal axis of + * the sphere (defaults to 16). + * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). + */ constructor(opts = {}) { super(); diff --git a/src/scene/geometry/torus-geometry.js b/src/scene/geometry/torus-geometry.js index 370f56ae3c9..44956d7ad9c 100644 --- a/src/scene/geometry/torus-geometry.js +++ b/src/scene/geometry/torus-geometry.js @@ -11,23 +11,25 @@ import { Geometry } from './geometry.js'; * * Note that the torus is created with UVs in the range of 0 to 1. * - * @param {import('../../platform/graphics/graphics-device.js').GraphicsDevice} device - The graphics - * device used to manage the mesh. - * @param {object} [opts] - An object that specifies optional inputs for the function as follows: - * @param {number} [opts.tubeRadius] - The radius of the tube forming the body of the torus - * (defaults to 0.2). - * @param {number} [opts.ringRadius] - The radius from the centre of the torus to the centre of the - * tube (defaults to 0.3). - * @param {number} [opts.sectorAngle] - The sector angle in degrees of the ring of the torus - * (defaults to 2 * Math.PI). - * @param {number} [opts.segments] - The number of radial divisions forming cross-sections of the - * torus ring (defaults to 20). - * @param {number} [opts.sides] - The number of divisions around the tubular body of the torus ring - * (defaults to 30). - * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). * @category Graphics */ class TorusGeometry extends Geometry { + /** + * Create a new TorusGeometry instance. + * + * @param {object} [opts] - An object that specifies optional inputs for the function as follows: + * @param {number} [opts.tubeRadius] - The radius of the tube forming the body of the torus + * (defaults to 0.2). + * @param {number} [opts.ringRadius] - The radius from the centre of the torus to the centre of the + * tube (defaults to 0.3). + * @param {number} [opts.sectorAngle] - The sector angle in degrees of the ring of the torus + * (defaults to 2 * Math.PI). + * @param {number} [opts.segments] - The number of radial divisions forming cross-sections of the + * torus ring (defaults to 20). + * @param {number} [opts.sides] - The number of divisions around the tubular body of the torus ring + * (defaults to 30). + * @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false). + */ constructor(opts = {}) { super();