Skip to content
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

Fixes to Geometry classes JSDocs #6282

Merged
merged 1 commit into from
Apr 24, 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
30 changes: 16 additions & 14 deletions src/scene/geometry/box-geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
26 changes: 14 additions & 12 deletions src/scene/geometry/capsule-geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 13 additions & 11 deletions src/scene/geometry/cone-geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 13 additions & 11 deletions src/scene/geometry/cylinder-geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 9 additions & 7 deletions src/scene/geometry/dome-geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 12 additions & 10 deletions src/scene/geometry/plane-geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
20 changes: 11 additions & 9 deletions src/scene/geometry/sphere-geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
30 changes: 16 additions & 14 deletions src/scene/geometry/torus-geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down