Bläddra i källkod

Docs: More JSDoc. (#30656)

Michael Herzog 10 månader sedan
förälder
incheckning
b1242211bc

+ 226 - 15
examples/jsm/csm/CSM.js

@@ -20,38 +20,179 @@ const _lightOrientationMatrix = new Matrix4();
 const _lightOrientationMatrixInverse = new Matrix4();
 const _up = new Vector3( 0, 1, 0 );
 
+/**
+ * An implementation of Cascade Shadow Maps (CSM).
+ *
+ * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer},
+ * use {@link CSMShadowNode} instead.
+ */
 export class CSM {
 
+	/**
+	 * Constructs a new CSM instance.
+	 *
+	 * @param {CSM~Data} data - The CSM data.
+	 */
 	constructor( data ) {
 
+		/**
+		 * The scene's camera.
+		 *
+		 * @type {Camera}
+		 */
 		this.camera = data.camera;
+
+		/**
+		 * The parent object, usually the scene.
+		 *
+		 * @type {Object3D}
+		 */
 		this.parent = data.parent;
+
+		/**
+		 * The number of cascades.
+		 *
+		 * @type {number}
+		 * @default 3
+		 */
 		this.cascades = data.cascades || 3;
+
+		/**
+		 * The maximum far value.
+		 *
+		 * @type {number}
+		 * @default 100000
+		 */
 		this.maxFar = data.maxFar || 100000;
+
+		/**
+		 * The frustum split mode.
+		 *
+		 * @type {('practical'|'uniform'|'logarithmic'|'custom')}
+		 * @default 'practical'
+		 */
 		this.mode = data.mode || 'practical';
+
+		/**
+		 * The shadow map size.
+		 *
+		 * @type {number}
+		 * @default 2048
+		 */
 		this.shadowMapSize = data.shadowMapSize || 2048;
+
+		/**
+		 * The shadow bias.
+		 *
+		 * @type {number}
+		 * @default 0.000001
+		 */
 		this.shadowBias = data.shadowBias || 0.000001;
+
+		/**
+		 * The light direction.
+		 *
+		 * @type {Vector3}
+		 */
 		this.lightDirection = data.lightDirection || new Vector3( 1, - 1, 1 ).normalize();
+
+		/**
+		 * The light intensity.
+		 *
+		 * @type {number}
+		 * @default 3
+		 */
 		this.lightIntensity = data.lightIntensity || 3;
+
+		/**
+		 * The light near value.
+		 *
+		 * @type {number}
+		 * @default 1
+		 */
 		this.lightNear = data.lightNear || 1;
+
+		/**
+		 * The light far value.
+		 *
+		 * @type {number}
+		 * @default 2000
+		 */
 		this.lightFar = data.lightFar || 2000;
+
+		/**
+		 * The light margin.
+		 *
+		 * @type {number}
+		 * @default 200
+		 */
 		this.lightMargin = data.lightMargin || 200;
+
+		/**
+		 * Custom split callback when using `mode='custom'`.
+		 *
+		 * @type {Function}
+		 */
 		this.customSplitsCallback = data.customSplitsCallback;
+
+		/**
+		 * Whether to fade between cascades or not.
+		 *
+		 * @type {boolean}
+		 * @default false
+		 */
 		this.fade = false;
+
+		/**
+		 * The main frustum.
+		 *
+		 * @type {CSMFrustum}
+		 */
 		this.mainFrustum = new CSMFrustum( { webGL: true } );
+
+		/**
+		 * An array of frustums representing the cascades.
+		 *
+		 * @type {Array<CSMFrustum>}
+		 */
 		this.frustums = [];
+
+		/**
+		 * An array of numbers in the range `[0,1]` the defines how the
+		 * mainCSM frustum should be split up.
+		 *
+		 * @type {Array<number>}
+		 */
 		this.breaks = [];
 
+		/**
+		 * An array of directional lights which cast the shadows for
+		 * the different cascades. There is one directional light for each
+		 * cascade.
+		 *
+		 * @type {Array<DirectionalLight>}
+		 */
 		this.lights = [];
+
+		/**
+		 * A Map holding enhanced material shaders.
+		 *
+		 * @type {Map<Material,Object>}
+		 */
 		this.shaders = new Map();
 
-		this.createLights();
+		this._createLights();
 		this.updateFrustums();
-		this.injectInclude();
+		this._injectInclude();
 
 	}
 
-	createLights() {
+	/**
+	 * Creates the directional lights of this CSM instance.
+	 *
+	 * @private
+	 */
+	_createLights() {
 
 		for ( let i = 0; i < this.cascades; i ++ ) {
 
@@ -72,7 +213,12 @@ export class CSM {
 
 	}
 
-	initCascades() {
+	/**
+	 * Inits the cascades according to the scene's camera and breaks configuration.
+	 *
+	 * @private
+	 */
+	_initCascades() {
 
 		const camera = this.camera;
 		camera.updateProjectionMatrix();
@@ -81,7 +227,12 @@ export class CSM {
 
 	}
 
-	updateShadowBounds() {
+	/**
+	 * Updates the shadow bounds of this CSM instance.
+	 *
+	 * @private
+	 */
+	_updateShadowBounds() {
 
 		const frustums = this.frustums;
 		for ( let i = 0; i < frustums.length; i ++ ) {
@@ -130,7 +281,13 @@ export class CSM {
 
 	}
 
-	getBreaks() {
+	/**
+	 * Computes the breaks of this CSM instance based on the scene's camera, number of cascades
+	 * and the selected split mode.
+	 *
+	 * @private
+	 */
+	_getBreaks() {
 
 		const camera = this.camera;
 		const far = Math.min( camera.far, this.maxFar );
@@ -197,6 +354,10 @@ export class CSM {
 
 	}
 
+	/**
+	 * Updates the CSM. This method must be called in your animation loop before
+	 * calling `renderer.render()`.
+	 */
 	update() {
 
 		const camera = this.camera;
@@ -243,13 +404,23 @@ export class CSM {
 
 	}
 
-	injectInclude() {
+	/**
+	 * Injects the CSM shader enhancements into the built-in materials.
+	 *
+	 * @private
+	 */
+	_injectInclude() {
 
 		ShaderChunk.lights_fragment_begin = CSMShader.lights_fragment_begin;
 		ShaderChunk.lights_pars_begin = CSMShader.lights_pars_begin;
 
 	}
 
+	/**
+	 * Applications must call this method for all materials that should be affected by CSM.
+	 *
+	 * @param {Material} material - The material to setup for CSM support.
+	 */
 	setupMaterial( material ) {
 
 		material.defines = material.defines || {};
@@ -269,7 +440,7 @@ export class CSM {
 		material.onBeforeCompile = function ( shader ) {
 
 			const far = Math.min( scope.camera.far, scope.maxFar );
-			scope.getExtendedBreaks( breaksVec2 );
+			scope._getExtendedBreaks( breaksVec2 );
 
 			shader.uniforms.CSM_cascades = { value: breaksVec2 };
 			shader.uniforms.cameraNear = { value: scope.camera.near };
@@ -283,7 +454,12 @@ export class CSM {
 
 	}
 
-	updateUniforms() {
+	/**
+	 * Updates the CSM uniforms.
+	 *
+	 * @private
+	 */
+	_updateUniforms() {
 
 		const far = Math.min( this.camera.far, this.maxFar );
 		const shaders = this.shaders;
@@ -293,7 +469,7 @@ export class CSM {
 			if ( shader !== null ) {
 
 				const uniforms = shader.uniforms;
-				this.getExtendedBreaks( uniforms.CSM_cascades.value );
+				this._getExtendedBreaks( uniforms.CSM_cascades.value );
 				uniforms.cameraNear.value = this.camera.near;
 				uniforms.shadowFar.value = far;
 
@@ -315,7 +491,13 @@ export class CSM {
 
 	}
 
-	getExtendedBreaks( target ) {
+	/**
+	 * Computes the extended breaks for the CSM uniforms.
+	 *
+	 * @private
+	 * @param {Array<Vector2>} target - The target array that holds the extended breaks.
+	 */
+	_getExtendedBreaks( target ) {
 
 		while ( target.length < this.breaks.length ) {
 
@@ -336,15 +518,21 @@ export class CSM {
 
 	}
 
+	/**
+	 * Applications must call this method every time they change camera or CSM settings.
+	 */
 	updateFrustums() {
 
-		this.getBreaks();
-		this.initCascades();
-		this.updateShadowBounds();
-		this.updateUniforms();
+		this._getBreaks();
+		this._initCascades();
+		this._updateShadowBounds();
+		this._updateUniforms();
 
 	}
 
+	/**
+	 * Applications must call this method when they remove the CSM usage from their scene.
+	 */
 	remove() {
 
 		for ( let i = 0; i < this.lights.length; i ++ ) {
@@ -356,6 +544,10 @@ export class CSM {
 
 	}
 
+	/**
+	 * Frees the GPU-related resources allocated by this instance. Call this
+	 * method whenever this instance is no longer used in your app.
+	 */
 	dispose() {
 
 		const shaders = this.shaders;
@@ -382,3 +574,22 @@ export class CSM {
 	}
 
 }
+
+/**
+ * Constructor data of `CSM`.
+ *
+ * @typedef {Object} CSM~Data
+ * @property {Camera} camera - The scene's camera.
+ * @property {Object3D} parent - The parent object, usually the scene.
+ * @property {number} [cascades=3] - The number of cascades.
+ * @property {number} [maxFar=100000] - The maximum far value.
+ * @property {('practical'|'uniform'|'logarithmic'|'custom')} [mode='practical'] - The frustum split mode.
+ * @property {Function} [customSplitsCallback] - Custom split callback when using `mode='custom'`.
+ * @property {number} [shadowMapSize=2048] - The shadow map size.
+ * @property {number} [shadowBias=0.000001] - The shadow bias.
+ * @property {Vector3} [lightDirection] - The light direction.
+ * @property {number} [lightIntensity=3] - The light intensity.
+ * @property {number} [lightNear=1] - The light near value.
+ * @property {number} [lightNear=2000] - The light far value.
+ * @property {number} [lightMargin=200] - The light margin.
+ **/

+ 52 - 0
examples/jsm/csm/CSMFrustum.js

@@ -2,14 +2,35 @@ import { Vector3, Matrix4 } from 'three';
 
 const inverseProjectionMatrix = new Matrix4();
 
+/**
+ * Represents the frustum of a CSM instance.
+ */
 class CSMFrustum {
 
+	/**
+	 * Constructs a new CSM frustum.
+	 *
+	 * @param {CSMFrustum~Data} data - The CSM data.
+	 */
 	constructor( data ) {
 
 		data = data || {};
 
+		/**
+		 * The zNear value. This value depends on whether the CSM
+		 * is used with WebGL or WebGPU. Both API use different
+		 * conventions for their projection matrices.
+		 *
+		 * @type {number}
+		 */
 		this.zNear = data.webGL === true ? - 1 : 0;
 
+		/**
+		 * An object representing the vertices of the near and
+		 * far plane in view space.
+		 *
+		 * @type {Object}
+		 */
 		this.vertices = {
 			near: [
 				new Vector3(),
@@ -33,6 +54,13 @@ class CSMFrustum {
 
 	}
 
+	/**
+	 * Setups this CSM frustum from the given projection matrix and max far value.
+	 *
+	 * @param {Matrix4} projectionMatrix - The projection matrix, ususally of the scene's camera.
+	 * @param {number} maxFar - The maximum far value.
+	 * @returns {Object} An object representing the vertices of the near and far plane in view space.
+	 */
 	setFromProjectionMatrix( projectionMatrix, maxFar ) {
 
 		const zNear = this.zNear;
@@ -80,6 +108,14 @@ class CSMFrustum {
 
 	}
 
+	/**
+	 * Splits the CSM frustum by the given array. The new CSM frustum are pushed into the given
+	 * target array.
+	 *
+	 * @param {Array<number>} breaks - An array of numbers in the range `[0,1]` the defines how the
+	 * CSM frustum should be split up.
+	 * @param {Array<CSMFrustum>} target - The target array that holds the new CSM frustums.
+	 */
 	split( breaks, target ) {
 
 		while ( breaks.length > target.length ) {
@@ -134,6 +170,13 @@ class CSMFrustum {
 
 	}
 
+	/**
+	 * Transforms the given target CSM frustum into the different coordinate system defined by the
+	 * given camera matrix.
+	 *
+	 * @param {Matrix4} cameraMatrix - The matrix that defines the new coordinate system.
+	 * @param {CSMFrustum} target - The CSM to convert.
+	 */
 	toSpace( cameraMatrix, target ) {
 
 		for ( let i = 0; i < 4; i ++ ) {
@@ -152,4 +195,13 @@ class CSMFrustum {
 
 }
 
+/**
+ * Constructor data of `CSMFrustum`.
+ *
+ * @typedef {Object} CSMFrustum~Data
+ * @property {boolean} [webGL] - Whether this CSM frustum is used with WebGL or WebGPU.
+ * @property {Matrix4} [projectionMatrix] - A projection matrix usually of the scene's camera.
+ * @property {number} [maxFar] - The maximum far value.
+ **/
+
 export { CSMFrustum };

+ 47 - 0
examples/jsm/csm/CSMHelper.js

@@ -12,14 +12,51 @@ import {
 	DoubleSide
 } from 'three';
 
+/**
+ * A helper for visualizing the cascades of a CSM instance.
+ *
+ * @augments Group
+ */
 class CSMHelper extends Group {
 
+	/**
+	 * Constructs a new CSM helper.
+	 *
+	 * @param {CSM|CSMShadowNode} csm - The CSM instance to visualize.
+	 */
 	constructor( csm ) {
 
 		super();
+
+		/**
+		 * The CSM instance to visualize.
+		 *
+		 * @type {CSM|CSMShadowNode}
+		 */
 		this.csm = csm;
+
+		/**
+		 * Whether to display the CSM frustum or not.
+		 *
+		 * @type {boolean}
+		 * @default true
+		 */
 		this.displayFrustum = true;
+
+		/**
+		 * Whether to display the cascade planes or not.
+		 *
+		 * @type {boolean}
+		 * @default true
+		 */
 		this.displayPlanes = true;
+
+		/**
+		 * Whether to display the shadow bounds or not.
+		 *
+		 * @type {boolean}
+		 * @default true
+		 */
 		this.displayShadowBounds = true;
 
 		const indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
@@ -37,6 +74,9 @@ class CSMHelper extends Group {
 
 	}
 
+	/**
+	 * This method must be called if one of the `display*` properties is changed at runtime.
+	 */
 	updateVisibility() {
 
 		const displayFrustum = this.displayFrustum;
@@ -63,6 +103,9 @@ class CSMHelper extends Group {
 
 	}
 
+	/**
+	 * Updates the helper. This method should be called in the app's animation loop.
+	 */
 	update() {
 
 		const csm = this.csm;
@@ -160,6 +203,10 @@ class CSMHelper extends Group {
 
 	}
 
+	/**
+	 * Frees the GPU-related resources allocated by this instance. Call this
+	 * method whenever this instance is no longer used in your app.
+	 */
 	dispose() {
 
 		const frustumLines = this.frustumLines;

+ 8 - 0
examples/jsm/csm/CSMShader.js

@@ -1,5 +1,13 @@
 import { ShaderChunk } from 'three';
 
+/** @module CSMShader */
+
+/**
+ * The object that holds the GLSL enhancements to enable CSM. This
+ * code is injected into the built-in material shaders by {@link CSM}.
+ *
+ * @type {Object}
+ */
 const CSMShader = {
 	lights_fragment_begin: /* glsl */`
 vec3 geometryPosition = - vViewPosition;

+ 156 - 13
examples/jsm/csm/CSMShadowNode.js

@@ -35,34 +35,126 @@ class LwLight extends Object3D {
 
 }
 
+/**
+ * An implementation of Cascade Shadow Maps (CSM).
+ *
+ * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer},
+ * use {@link CSM} instead.
+ *
+ * @augments ShadowBaseNode
+ */
 class CSMShadowNode extends ShadowBaseNode {
 
+	/**
+	 * Constructs a new CSM shadow node.
+	 *
+	 * @param {DirectionalLight} light - The CSM light.
+	 * @param {CSMShadowNode~Data} data - The CSM data.
+	 */
 	constructor( light, data = {} ) {
 
 		super( light );
 
+		/**
+		 * The scene's camera.
+		 *
+		 * @type {?Camera}
+		 * @default null
+		 */
 		this.camera = null;
+
+		/**
+		 * The number of cascades.
+		 *
+		 * @type {number}
+		 * @default 3
+		 */
 		this.cascades = data.cascades || 3;
+
+		/**
+		 * The maximum far value.
+		 *
+		 * @type {number}
+		 * @default 100000
+		 */
 		this.maxFar = data.maxFar || 100000;
+
+		/**
+		 * The frustum split mode.
+		 *
+		 * @type {('practical'|'uniform'|'logarithmic'|'custom')}
+		 * @default 'practical'
+		 */
 		this.mode = data.mode || 'practical';
+
+		/**
+		 * The light margin.
+		 *
+		 * @type {number}
+		 * @default 200
+		 */
 		this.lightMargin = data.lightMargin || 200;
+
+		/**
+		 * Custom split callback when using `mode='custom'`.
+		 *
+		 * @type {Function}
+		 */
 		this.customSplitsCallback = data.customSplitsCallback;
 
+		/**
+		 * Whether to fade between cascades or not.
+		 *
+		 * @type {boolean}
+		 * @default false
+		 */
 		this.fade = false;
 
+		/**
+		 * An array of numbers in the range `[0,1]` the defines how the
+		 * mainCSM frustum should be split up.
+		 *
+		 * @type {Array<number>}
+		 */
 		this.breaks = [];
 
 		this._cascades = [];
+
+		/**
+		 * The main frustum.
+		 *
+		 * @type {?CSMFrustum}
+		 * @default null
+		 */
 		this.mainFrustum = null;
+
+		/**
+		 * An array of frustums representing the cascades.
+		 *
+		 * @type {Array<CSMFrustum>}
+		 */
 		this.frustums = [];
 
+		/**
+		 * An array of directional lights which cast the shadows for
+		 * the different cascades. There is one directional light for each
+		 * cascade.
+		 *
+		 * @type {Array<DirectionalLight>}
+		 */
 		this.lights = [];
 
 		this._shadowNodes = [];
 
 	}
 
-	init( { camera, renderer } ) {
+	/**
+	 * Inits the CSM shadow node.
+	 *
+	 * @private
+	 * @param {NodeBuilder} builder - The node builder.
+	 */
+	_init( { camera, renderer } ) {
 
 		this.camera = camera;
 
@@ -97,7 +189,12 @@ class CSMShadowNode extends ShadowBaseNode {
 
 	}
 
-	initCascades() {
+	/**
+	 * Inits the cascades according to the scene's camera and breaks configuration.
+	 *
+	 * @private
+	 */
+	_initCascades() {
 
 		const camera = this.camera;
 		camera.updateProjectionMatrix();
@@ -107,7 +204,13 @@ class CSMShadowNode extends ShadowBaseNode {
 
 	}
 
-	getBreaks() {
+	/**
+	 * Computes the breaks of this CSM instance based on the scene's camera, number of cascades
+	 * and the selected split mode.
+	 *
+	 * @private
+	 */
+	_getBreaks() {
 
 		const camera = this.camera;
 		const far = Math.min( camera.far, this.maxFar );
@@ -178,7 +281,12 @@ class CSMShadowNode extends ShadowBaseNode {
 
 	}
 
-	setLightBreaks() {
+	/**
+	 * Sets the ligth breaks.
+	 *
+	 * @private
+	 */
+	_setLightBreaks() {
 
 		for ( let i = 0, l = this.cascades; i < l; i ++ ) {
 
@@ -191,7 +299,12 @@ class CSMShadowNode extends ShadowBaseNode {
 
 	}
 
-	updateShadowBounds() {
+	/**
+	 * Updates the shadow bounds of this CSM instance.
+	 *
+	 * @private
+	 */
+	_updateShadowBounds() {
 
 		const frustums = this.frustums;
 
@@ -243,16 +356,25 @@ class CSMShadowNode extends ShadowBaseNode {
 
 	}
 
+	/**
+	 * Applications must call this method every time they change camera or CSM settings.
+	 */
 	updateFrustums() {
 
-		this.getBreaks();
-		this.initCascades();
-		this.updateShadowBounds();
-		this.setLightBreaks();
+		this._getBreaks();
+		this._initCascades();
+		this._updateShadowBounds();
+		this._setLightBreaks();
 
 	}
 
-	setupFade() {
+	/**
+	 * Setups the TSL when using fading.
+	 *
+	 * @private
+	 * @return {ShaderCallNodeInternal}
+	 */
+	_setupFade() {
 
 		const cameraNear = reference( 'camera.near', 'float', this ).setGroup( renderGroup );
 		const cascades = reference( '_cascades', 'vec2', this ).setGroup( renderGroup ).label( 'cascades' );
@@ -328,7 +450,13 @@ class CSMShadowNode extends ShadowBaseNode {
 
 	}
 
-	setupStandard() {
+	/**
+	 * Setups the TSL when no fading (default).
+	 *
+	 * @private
+	 * @return {ShaderCallNodeInternal}
+	 */
+	_setupStandard() {
 
 		const cameraNear = reference( 'camera.near', 'float', this ).setGroup( renderGroup );
 		const cascades = reference( '_cascades', 'vec2', this ).setGroup( renderGroup ).label( 'cascades' );
@@ -365,9 +493,9 @@ class CSMShadowNode extends ShadowBaseNode {
 
 	setup( builder ) {
 
-		if ( this.camera === null ) this.init( builder );
+		if ( this.camera === null ) this._init( builder );
 
-		return this.fade === true ? this.setupFade() : this.setupStandard();
+		return this.fade === true ? this._setupFade() : this._setupStandard();
 
 	}
 
@@ -421,6 +549,10 @@ class CSMShadowNode extends ShadowBaseNode {
 
 	}
 
+	/**
+	 * Frees the GPU-related resources allocated by this instance. Call this
+	 * method whenever this instance is no longer used in your app.
+	 */
 	dispose() {
 
 		for ( let i = 0; i < this.lights.length; i ++ ) {
@@ -439,4 +571,15 @@ class CSMShadowNode extends ShadowBaseNode {
 
 }
 
+/**
+ * Constructor data of `CSMShadowNode`.
+ *
+ * @typedef {Object} CSMShadowNode~Data
+ * @property {number} [cascades=3] - The number of cascades.
+ * @property {number} [maxFar=100000] - The maximum far value.
+ * @property {('practical'|'uniform'|'logarithmic'|'custom')} [mode='practical'] - The frustum split mode.
+ * @property {Function} [customSplitsCallback] - Custom split callback when using `mode='custom'`.
+ * @property {number} [lightMargin=200] - The light margin.
+ **/
+
 export { CSMShadowNode };

+ 36 - 0
examples/jsm/lines/Line2.js

@@ -2,12 +2,48 @@ import { LineSegments2 } from '../lines/LineSegments2.js';
 import { LineGeometry } from '../lines/LineGeometry.js';
 import { LineMaterial } from '../lines/LineMaterial.js';
 
+/**
+ * A polyline drawn between vertices.
+ *
+ * This adds functionality beyond {@link Line}, like arbitrary line width and changing width to
+ * be in world units.It extends {@link LineSegments2}, simplifying constructing segments from a
+ * chain of points.
+ *
+ * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer},
+ * import the class from `lines/webgpu/Line2.js`.
+ *
+ * ```js
+ * const geometry = new LineGeometry();
+ * geometry.setPositions( positions );
+ * geometry.setColors( colors );
+ *
+ * const material = new LineMaterial( { linewidth: 5, vertexColors: true } };
+ *
+ * const line = new Line2( geometry, material );
+ * scene.add( line );
+ * ```
+ *
+ * @augments LineSegments2
+ */
 class Line2 extends LineSegments2 {
 
+	/**
+	 * Constructs a new wide line.
+	 *
+	 * @param {LineGeometry} [geometry] - The line geometry.
+	 * @param {LineMaterial} [material] - The line material.
+	 */
 	constructor( geometry = new LineGeometry(), material = new LineMaterial( { color: Math.random() * 0xffffff } ) ) {
 
 		super( geometry, material );
 
+		/**
+		 * This flag can be used for type testing.
+		 *
+		 * @type {boolean}
+		 * @readonly
+		 * @default true
+		 */
 		this.isLine2 = true;
 
 		this.type = 'Line2';

+ 52 - 0
examples/jsm/lines/LineGeometry.js

@@ -1,17 +1,51 @@
 import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js';
 
+/**
+ * A chain of vertices, forming a polyline.
+ *
+ * This is used in {@link Line2} to describe the shape.
+ *
+ * ```js
+ * const points = [
+ * 	new THREE.Vector3( - 10, 0, 0 ),
+ * 	new THREE.Vector3( 0, 5, 0 ),
+ * 	new THREE.Vector3( 10, 0, 0 ),
+ * ];
+ *
+ * const geometry = new LineGeometry();
+ * geometry.setFromPoints( points );
+ * ```
+ *
+ * @augments LineSegmentsGeometry
+ */
 class LineGeometry extends LineSegmentsGeometry {
 
+	/**
+	 * Constructs a new line geometry.
+	 */
 	constructor() {
 
 		super();
 
+		/**
+		 * This flag can be used for type testing.
+		 *
+		 * @type {boolean}
+		 * @readonly
+		 * @default true
+		 */
 		this.isLineGeometry = true;
 
 		this.type = 'LineGeometry';
 
 	}
 
+	/**
+	 * Sets the given line positions for this goemetry.
+	 *
+	 * @param {Float32|Array} array - The position data to set.
+	 * @return {LineGeometry} A reference to this geometry.
+	 */
 	setPositions( array ) {
 
 		// converts [ x1, y1, z1,  x2, y2, z2, ... ] to pairs format
@@ -37,6 +71,12 @@ class LineGeometry extends LineSegmentsGeometry {
 
 	}
 
+	/**
+	 * Sets the given line colors for this goemetry.
+	 *
+	 * @param {Float32|Array} array - The position data to set.
+	 * @return {LineGeometry} A reference to this geometry.
+	 */
 	setColors( array ) {
 
 		// converts [ r1, g1, b1,  r2, g2, b2, ... ] to pairs format
@@ -62,6 +102,12 @@ class LineGeometry extends LineSegmentsGeometry {
 
 	}
 
+	/**
+	 * Setups this line segments geometry from the given sequence of points.
+	 *
+	 * @param {Array<Vector3|Vector2>} points - An array of points in 2D or 3D space.
+	 * @return {LineGeometry} A reference to this geometry.
+	 */
 	setFromPoints( points ) {
 
 		// converts a vector3 or vector2 array to pairs format
@@ -87,6 +133,12 @@ class LineGeometry extends LineSegmentsGeometry {
 
 	}
 
+	/**
+	 * Setups this line segments geometry from the given line.
+	 *
+	 * @param {Line} line - The line that should be used as a data source for this geometry.
+	 * @return {LineGeometry} A reference to this geometry.
+	 */
 	fromLine( line ) {
 
 		const geometry = line.geometry;

+ 95 - 0
examples/jsm/lines/LineMaterial.js

@@ -403,8 +403,28 @@ ShaderLib[ 'line' ] = {
 		`
 };
 
+/**
+ * A material for drawing wireframe-style geometries.
+ *
+ * Unlike {@link LineBasicMaterial}, it supports arbitrary line widths and allows using world units
+ * instead of screen space units. This material is used with {@link LineSegments2} and {@link Line2}.
+ *
+ * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer},
+ * use {@link Line2NodeMaterial}.
+ *
+ * @augments ShaderMaterial
+ */
 class LineMaterial extends ShaderMaterial {
 
+	/**
+	 * Constructs a new line segments geometry.
+	 *
+	 * @param {Object} [parameters] - An object with one or more properties
+	 * defining the material's appearance. Any property of the material
+	 * (including any property from inherited materials) can be passed
+	 * in here. Color values can be passed any type of value accepted
+	 * by {@link Color#set}.
+	 */
 	constructor( parameters ) {
 
 		super( {
@@ -419,12 +439,25 @@ class LineMaterial extends ShaderMaterial {
 
 		} );
 
+		/**
+		 * This flag can be used for type testing.
+		 *
+		 * @type {boolean}
+		 * @readonly
+		 * @default true
+		 */
 		this.isLineMaterial = true;
 
 		this.setValues( parameters );
 
 	}
 
+	/**
+	 * The material's color.
+	 *
+	 * @type {Color}
+	 * @default (1,1,1)
+	 */
 	get color() {
 
 		return this.uniforms.diffuse.value;
@@ -437,6 +470,12 @@ class LineMaterial extends ShaderMaterial {
 
 	}
 
+	/**
+	 * Whether the material's sizes (width, dash gaps) are in world units.
+	 *
+	 * @type {boolean}
+	 * @default false
+	 */
 	get worldUnits() {
 
 		return 'WORLD_UNITS' in this.defines;
@@ -457,6 +496,13 @@ class LineMaterial extends ShaderMaterial {
 
 	}
 
+	/**
+	 * Controls line thickness in CSS pixel units when `worldUnits` is `false` (default),
+	 * or in world units when `worldUnits` is `true`.
+	 *
+	 * @type {number}
+	 * @default 1
+	 */
 	get linewidth() {
 
 		return this.uniforms.linewidth.value;
@@ -470,6 +516,12 @@ class LineMaterial extends ShaderMaterial {
 
 	}
 
+	/**
+	 * Whether the line is dashed, or solid.
+	 *
+	 * @type {boolean}
+	 * @default false
+	 */
 	get dashed() {
 
 		return 'USE_DASH' in this.defines;
@@ -496,6 +548,12 @@ class LineMaterial extends ShaderMaterial {
 
 	}
 
+	/**
+	 * The scale of the dashes and gaps.
+	 *
+	 * @type {number}
+	 * @default 1
+	 */
 	get dashScale() {
 
 		return this.uniforms.dashScale.value;
@@ -508,6 +566,12 @@ class LineMaterial extends ShaderMaterial {
 
 	}
 
+	/**
+	 * The size of the dash.
+	 *
+	 * @type {number}
+	 * @default 1
+	 */
 	get dashSize() {
 
 		return this.uniforms.dashSize.value;
@@ -520,6 +584,12 @@ class LineMaterial extends ShaderMaterial {
 
 	}
 
+	/**
+	 * Where in the dash cycle the dash starts.
+	 *
+	 * @type {number}
+	 * @default 0
+	 */
 	get dashOffset() {
 
 		return this.uniforms.dashOffset.value;
@@ -532,6 +602,12 @@ class LineMaterial extends ShaderMaterial {
 
 	}
 
+	/**
+	 * The size of the gap.
+	 *
+	 * @type {number}
+	 * @default 0
+	 */
 	get gapSize() {
 
 		return this.uniforms.gapSize.value;
@@ -544,6 +620,12 @@ class LineMaterial extends ShaderMaterial {
 
 	}
 
+	/**
+	 * The opacity.
+	 *
+	 * @type {number}
+	 * @default 1
+	 */
 	get opacity() {
 
 		return this.uniforms.opacity.value;
@@ -557,6 +639,13 @@ class LineMaterial extends ShaderMaterial {
 
 	}
 
+	/**
+	 * The size of the viewport, in screen pixels. This must be kept updated to make
+	 * screen-space rendering accurate.The `LineSegments2.onBeforeRender` callback
+	 * performs the update for visible objects.
+	 *
+	 * @type {Vector2}
+	 */
 	get resolution() {
 
 		return this.uniforms.resolution.value;
@@ -569,6 +658,12 @@ class LineMaterial extends ShaderMaterial {
 
 	}
 
+	/**
+	 * Whether to use alphaToCoverage or not. When enabled, this can improve the
+	 * anti-aliasing of line edges when using MSAA.
+	 *
+	 * @type {Vector2}
+	 */
 	get alphaToCoverage() {
 
 		return 'USE_ALPHA_TO_COVERAGE' in this.defines;

+ 51 - 2
examples/jsm/lines/LineSegments2.js

@@ -224,22 +224,65 @@ function raycastScreenSpace( lineSegments, camera, intersects ) {
 
 }
 
+/**
+ * A series of lines drawn between pairs of vertices.
+ *
+ * This adds functionality beyond {@link LineSegments}, like arbitrary line width and changing width
+ * to be in world units. {@link Line2} extends this object, forming a polyline instead of individual
+ * segments.
+ *
+ * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer},
+ * import the class from `lines/webgpu/LineSegments2.js`.
+ *
+ *  ```js
+ * const geometry = new LineSegmentsGeometry();
+ * geometry.setPositions( positions );
+ * geometry.setColors( colors );
+ *
+ * const material = new LineMaterial( { linewidth: 5, vertexColors: true } };
+ *
+ * const lineSegments = new LineSegments2( geometry, material );
+ * scene.add( lineSegments );
+ * ```
+ *
+ * @augments Mesh
+ */
 class LineSegments2 extends Mesh {
 
+	/**
+	 * Constructs a new wide line.
+	 *
+	 * @param {LineSegmentsGeometry} [geometry] - The line geometry.
+	 * @param {LineMaterial} [material] - The line material.
+	 */
 	constructor( geometry = new LineSegmentsGeometry(), material = new LineMaterial( { color: Math.random() * 0xffffff } ) ) {
 
 		super( geometry, material );
 
+		/**
+		 * This flag can be used for type testing.
+		 *
+		 * @type {boolean}
+		 * @readonly
+		 * @default true
+		 */
 		this.isLineSegments2 = true;
 
 		this.type = 'LineSegments2';
 
 	}
 
-	// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
-
+	/**
+	 * Computes an array of distance values which are necessary for rendering dashed lines.
+	 * For each vertex in the geometry, the method calculates the cumulative length from the
+	 * current point to the very beginning of the line.
+	 *
+	 * @return {LineSegments2} A reference to this instance.
+	 */
 	computeLineDistances() {
 
+		// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
+
 		const geometry = this.geometry;
 
 		const instanceStart = geometry.attributes.instanceStart;
@@ -265,6 +308,12 @@ class LineSegments2 extends Mesh {
 
 	}
 
+	/**
+	 * Computes intersection points between a casted ray and this instance.
+	 *
+	 * @param {Raycaster} raycaster - The raycaster.
+	 * @param {Array<Object>} intersects - The target array that holds the intersection points.
+	 */
 	raycast( raycaster, intersects ) {
 
 		const worldUnits = this.material.worldUnits;

+ 62 - 8
examples/jsm/lines/LineSegmentsGeometry.js

@@ -12,12 +12,29 @@ import {
 const _box = new Box3();
 const _vector = new Vector3();
 
+/**
+ * A series of vertex pairs, forming line segments.
+ *
+ * This is used in {@link LineSegments2} to describe the shape.
+ *
+ * @augments InstancedBufferGeometry
+ */
 class LineSegmentsGeometry extends InstancedBufferGeometry {
 
+	/**
+	 * Constructs a new line segments geometry.
+	 */
 	constructor() {
 
 		super();
 
+		/**
+		 * This flag can be used for type testing.
+		 *
+		 * @type {boolean}
+		 * @readonly
+		 * @default true
+		 */
 		this.isLineSegmentsGeometry = true;
 
 		this.type = 'LineSegmentsGeometry';
@@ -32,6 +49,12 @@ class LineSegmentsGeometry extends InstancedBufferGeometry {
 
 	}
 
+	/**
+	 * Applies the given 4x4 tranformation matrix to the geometry.
+	 *
+	 * @param {Matrix4} matrix - The matrix to apply.
+	 * @return {LineSegmentsGeometry} A reference to this instance.
+	 */
 	applyMatrix4( matrix ) {
 
 		const start = this.attributes.instanceStart;
@@ -63,6 +86,13 @@ class LineSegmentsGeometry extends InstancedBufferGeometry {
 
 	}
 
+	/**
+	 * Sets the given line positions for this goemetry. The length must be a multiple of six since
+	 * each line segment is defined by a start end vertex in the pattern `(xyz xyz)`.
+	 *
+	 * @param {Float32|Array} array - The position data to set.
+	 * @return {LineSegmentsGeometry} A reference to this geometry.
+	 */
 	setPositions( array ) {
 
 		let lineSegments;
@@ -93,6 +123,13 @@ class LineSegmentsGeometry extends InstancedBufferGeometry {
 
 	}
 
+	/**
+	 * Sets the given line colors for this goemetry. The length must be a multiple of six since
+	 * each line segment is defined by a start end color in the pattern `(rgb rgb)`.
+	 *
+	 * @param {Float32|Array} array - The position data to set.
+	 * @return {LineSegmentsGeometry} A reference to this geometry.
+	 */
 	setColors( array ) {
 
 		let colors;
@@ -116,6 +153,12 @@ class LineSegmentsGeometry extends InstancedBufferGeometry {
 
 	}
 
+	/**
+	 * Setups this line segments geometry from the given wireframe geometry.
+	 *
+	 * @param {WireframeGeometry} geometry - The geometry that should be used as a data source for this geometry.
+	 * @return {LineSegmentsGeometry} A reference to this geometry.
+	 */
 	fromWireframeGeometry( geometry ) {
 
 		this.setPositions( geometry.attributes.position.array );
@@ -124,6 +167,12 @@ class LineSegmentsGeometry extends InstancedBufferGeometry {
 
 	}
 
+	/**
+	 * Setups this line segments geometry from the given edges geometry.
+	 *
+	 * @param {EdgesGeometry} geometry - The geometry that should be used as a data source for this geometry.
+	 * @return {LineSegmentsGeometry} A reference to this geometry.
+	 */
 	fromEdgesGeometry( geometry ) {
 
 		this.setPositions( geometry.attributes.position.array );
@@ -132,6 +181,12 @@ class LineSegmentsGeometry extends InstancedBufferGeometry {
 
 	}
 
+	/**
+	 * Setups this line segments geometry from the given mesh.
+	 *
+	 * @param {Mesh} mesh - The mesh geometry that should be used as a data source for this geometry.
+	 * @return {LineSegmentsGeometry} A reference to this geometry.
+	 */
 	fromMesh( mesh ) {
 
 		this.fromWireframeGeometry( new WireframeGeometry( mesh.geometry ) );
@@ -142,6 +197,13 @@ class LineSegmentsGeometry extends InstancedBufferGeometry {
 
 	}
 
+	/**
+	 * Setups this line segments geometry from the given line segments.
+	 *
+	 * @param {LineSegments} lineSegments - The line segments that should be used as a data source for this geometry.
+	 * Assumes the source geometry is not using indices.
+	 * @return {LineSegmentsGeometry} A reference to this geometry.
+	 */
 	fromLineSegments( lineSegments ) {
 
 		const geometry = lineSegments.geometry;
@@ -230,14 +292,6 @@ class LineSegmentsGeometry extends InstancedBufferGeometry {
 
 	}
 
-	applyMatrix( matrix ) {
-
-		console.warn( 'THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().' );
-
-		return this.applyMatrix4( matrix );
-
-	}
-
 }
 
 export { LineSegmentsGeometry };

+ 38 - 2
examples/jsm/lines/Wireframe.js

@@ -12,22 +12,58 @@ const _start = new Vector3();
 const _end = new Vector3();
 const _viewport = new Vector4();
 
+/**
+ * A class for creating wireframes based on wide lines.
+ *
+ * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer},
+ * import the class from `lines/webgpu/Wireframe.js`.
+ *
+ * ```js
+ * const geometry = new THREE.IcosahedronGeometry();
+ * const wireframeGeometry = new WireframeGeometry2( geo );
+ *
+ * const wireframe = new Wireframe( wireframeGeometry, material );
+ * scene.add( wireframe );
+ * ```
+ *
+ * @augments Mesh
+ */
 class Wireframe extends Mesh {
 
+	/**
+	 * Constructs a new wireframe.
+	 *
+	 * @param {LineSegmentsGeometry} [geometry] - The line geometry.
+	 * @param {LineMaterial} [material] - The line material.
+	 */
 	constructor( geometry = new LineSegmentsGeometry(), material = new LineMaterial( { color: Math.random() * 0xffffff } ) ) {
 
 		super( geometry, material );
 
+		/**
+		 * This flag can be used for type testing.
+		 *
+		 * @type {boolean}
+		 * @readonly
+		 * @default true
+		 */
 		this.isWireframe = true;
 
 		this.type = 'Wireframe';
 
 	}
 
-	// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
-
+	/**
+	 * Computes an array of distance values which are necessary for rendering dashed lines.
+	 * For each vertex in the geometry, the method calculates the cumulative length from the
+	 * current point to the very beginning of the line.
+	 *
+	 * @return {Wireframe} A reference to this instance.
+	 */
 	computeLineDistances() {
 
+		// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
+
 		const geometry = this.geometry;
 
 		const instanceStart = geometry.attributes.instanceStart;

+ 24 - 0
examples/jsm/lines/WireframeGeometry2.js

@@ -3,12 +3,36 @@ import {
 } from 'three';
 import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js';
 
+/**
+ * A special type of line segments geometry intended for wireframe rendering.
+ *
+ * This is used in {@link Wireframe} to describe the shape.
+ *
+ * ```js
+ * const geometry = new THREE.IcosahedronGeometry();
+ * const wireframeGeometry = new WireframeGeometry2( geo );
+ * ```
+ *
+ * @augments LineSegmentsGeometry
+ */
 class WireframeGeometry2 extends LineSegmentsGeometry {
 
+	/**
+	 * Constructs a new wireframe geometry.
+	 *
+	 * @param {BufferGeometry} [geometry] - The geometry to render the wireframe for.
+	 */
 	constructor( geometry ) {
 
 		super();
 
+		/**
+		 * This flag can be used for type testing.
+		 *
+		 * @type {boolean}
+		 * @readonly
+		 * @default true
+		 */
 		this.isWireframeGeometry2 = true;
 
 		this.type = 'WireframeGeometry2';

+ 25 - 1
examples/jsm/lines/webgpu/Line2.js

@@ -3,13 +3,37 @@ import { Line2NodeMaterial } from 'three/webgpu';
 import { LineSegments2 } from './LineSegments2.js';
 import { LineGeometry } from '../LineGeometry.js';
 
-
+/**
+ * A polyline drawn between vertices.
+ *
+ * This adds functionality beyond {@link Line}, like arbitrary line width and changing width to
+ * be in world units.It extends {@link LineSegments2}, simplifying constructing segments from a
+ * chain of points.
+ *
+ * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer},
+ * import the class from `lines/Line2.js`.
+ *
+ * @augments LineSegments2
+ */
 class Line2 extends LineSegments2 {
 
+	/**
+	 * Constructs a new wide line.
+	 *
+	 * @param {LineGeometry} [geometry] - The line geometry.
+	 * @param {Line2NodeMaterial} [material] - The line material.
+	 */
 	constructor( geometry = new LineGeometry(), material = new Line2NodeMaterial( { color: Math.random() * 0xffffff } ) ) {
 
 		super( geometry, material );
 
+		/**
+		 * This flag can be used for type testing.
+		 *
+		 * @type {boolean}
+		 * @readonly
+		 * @default true
+		 */
 		this.isLine2 = true;
 
 		this.type = 'Line2';

+ 44 - 6
examples/jsm/lines/webgpu/LineSegments2.js

@@ -223,24 +223,56 @@ function raycastScreenSpace( lineSegments, camera, intersects ) {
 
 }
 
+/**
+ * A series of lines drawn between pairs of vertices.
+ *
+ * This adds functionality beyond {@link LineSegments}, like arbitrary line width and changing width
+ * to be in world units. {@link Line2} extends this object, forming a polyline instead of individual
+ * segments.
+ *
+ * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer},
+ * import the class from `lines/LineSegments2.js`.
+ *
+ * @augments Mesh
+ */
 class LineSegments2 extends Mesh {
 
+	/**
+	 * Constructs a new wide line.
+	 *
+	 * @param {LineSegmentsGeometry} [geometry] - The line geometry.
+	 * @param {Line2NodeMaterial} [material] - The line material.
+	 */
 	constructor( geometry = new LineSegmentsGeometry(), material = new Line2NodeMaterial( { color: Math.random() * 0xffffff } ) ) {
 
 		super( geometry, material );
 
+		/**
+		 * This flag can be used for type testing.
+		 *
+		 * @type {boolean}
+		 * @readonly
+		 * @default true
+		 */
 		this.isLineSegments2 = true;
 
 		this.type = 'LineSegments2';
 
-		this.resolution = new Vector2();
+		this._resolution = new Vector2();
 
 	}
 
-	// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
-
+	/**
+	 * Computes an array of distance values which are necessary for rendering dashed lines.
+	 * For each vertex in the geometry, the method calculates the cumulative length from the
+	 * current point to the very beginning of the line.
+	 *
+	 * @return {LineSegments2} A reference to this instance.
+	 */
 	computeLineDistances() {
 
+		// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
+
 		const geometry = this.geometry;
 
 		const instanceStart = geometry.attributes.instanceStart;
@@ -269,10 +301,16 @@ class LineSegments2 extends Mesh {
 	onBeforeRender( renderer ) {
 
 		renderer.getViewport( _viewport );
-		this.resolution.set( _viewport.z, _viewport.w );
+		this._resolution.set( _viewport.z, _viewport.w );
 
 	}
 
+	/**
+	 * Computes intersection points between a casted ray and this instance.
+	 *
+	 * @param {Raycaster} raycaster - The raycaster.
+	 * @param {Array<Object>} intersects - The target array that holds the intersection points.
+	 */
 	raycast( raycaster, intersects ) {
 
 		const worldUnits = this.material.worldUnits;
@@ -312,7 +350,7 @@ class LineSegments2 extends Mesh {
 		} else {
 
 			const distanceToSphere = Math.max( camera.near, _sphere.distanceToPoint( _ray.origin ) );
-			sphereMargin = getWorldSpaceHalfWidth( camera, distanceToSphere, this.resolution );
+			sphereMargin = getWorldSpaceHalfWidth( camera, distanceToSphere, this._resolution );
 
 		}
 
@@ -342,7 +380,7 @@ class LineSegments2 extends Mesh {
 		} else {
 
 			const distanceToBox = Math.max( camera.near, _box.distanceToPoint( _ray.origin ) );
-			boxMargin = getWorldSpaceHalfWidth( camera, distanceToBox, this.resolution );
+			boxMargin = getWorldSpaceHalfWidth( camera, distanceToBox, this._resolution );
 
 		}
 

+ 30 - 2
examples/jsm/lines/webgpu/Wireframe.js

@@ -11,22 +11,50 @@ import { LineSegmentsGeometry } from '../../lines/LineSegmentsGeometry.js';
 const _start = new Vector3();
 const _end = new Vector3();
 
+/**
+ * A class for creating wireframes based on wide lines.
+ *
+ * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer},
+ * import the class from `lines/Wireframe.js`.
+ *
+ * @augments Mesh
+ */
 class Wireframe extends Mesh {
 
+	/**
+	 * Constructs a new wireframe.
+	 *
+	 * @param {LineSegmentsGeometry} [geometry] - The line geometry.
+	 * @param {Line2NodeMaterial} [material] - The line material.
+	 */
 	constructor( geometry = new LineSegmentsGeometry(), material = new Line2NodeMaterial( { color: Math.random() * 0xffffff } ) ) {
 
 		super( geometry, material );
 
+		/**
+		 * This flag can be used for type testing.
+		 *
+		 * @type {boolean}
+		 * @readonly
+		 * @default true
+		 */
 		this.isWireframe = true;
 
 		this.type = 'Wireframe';
 
 	}
 
-	// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
-
+	/**
+	 * Computes an array of distance values which are necessary for rendering dashed lines.
+	 * For each vertex in the geometry, the method calculates the cumulative length from the
+	 * current point to the very beginning of the line.
+	 *
+	 * @return {Wireframe} A reference to this instance.
+	 */
 	computeLineDistances() {
 
+		// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
+
 		const geometry = this.geometry;
 
 		const instanceStart = geometry.attributes.instanceStart;

+ 4 - 1
utils/docs/jsdoc.config.json

@@ -15,6 +15,7 @@
             "examples/jsm/animation",
             "examples/jsm/capabilities",
             "examples/jsm/controls",
+            "examples/jsm/csm",
             "examples/jsm/curves",
             "examples/jsm/effects",
             "examples/jsm/environments",
@@ -24,6 +25,7 @@
             "examples/jsm/interactive",
             "examples/jsm/lighting",
             "examples/jsm/lights",
+            "examples/jsm/lines",
             "examples/jsm/textures",
             "examples/jsm/tsl",
             "src"
@@ -31,7 +33,8 @@
         "exclude": [
             "src/renderers/common/extras/PMREMGenerator.js",
             "examples/jsm/helpers/LightProbeHelperGPU.js",
-            "examples/jsm/helpers/TextureHelperGPU.js"
+            "examples/jsm/helpers/TextureHelperGPU.js",
+            "examples/jsm/lines/webgpu"
         ]
     }
 }

粤ICP备19079148号