Skip to content

Commit 008362f

Browse files
authored
Docs: More JSDoc. (mrdoob#30631)
1 parent aea3452 commit 008362f

33 files changed

+2581
-23
lines changed

src/core/Object3D.js

+23
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,29 @@ class Object3D extends EventDispatcher {
330330
*/
331331
this.animations = [];
332332

333+
/**
334+
* Custom depth material to be used when rendering to the depth map. Can only be used
335+
* in context of meshes. When shadow-casting with a {@link DirectionalLight} or {@link SpotLight},
336+
* if you are modifying vertex positions in the vertex shader you must specify a custom depth
337+
* material for proper shadows.
338+
*
339+
* Only relevant in context of {@link WebGLRenderer}.
340+
*
341+
* @type {(Material|undefined)}
342+
* @default undefined
343+
*/
344+
this.customDepthMaterial = undefined;
345+
346+
/**
347+
* Same as {@link Object3D#customDepthMaterial}, but used with {@link PointLight}.
348+
*
349+
* Only relevant in context of {@link WebGLRenderer}.
350+
*
351+
* @type {(Material|undefined)}
352+
* @default undefined
353+
*/
354+
this.customDistanceMaterial = undefined;
355+
333356
/**
334357
* An object that can be used to store custom data about the 3D object. It
335358
* should not hold references to functions as these will not be cloned.

src/materials/LineBasicMaterial.js

+74-1
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,104 @@
11
import { Material } from './Material.js';
22
import { Color } from '../math/Color.js';
33

4+
/**
5+
* A material for rendering line primitives.
6+
*
7+
* Materials define the appearance of renderable 3D objects.
8+
*
9+
* ```js
10+
* const material = new THREE.LineBasicMaterial( { color: 0xffffff } );
11+
* ```
12+
*
13+
* @augments Material
14+
*/
415
class LineBasicMaterial extends Material {
516

17+
/**
18+
* Constructs a new line basic material.
19+
*
20+
* @param {Object} parameters - An object with one or more properties
21+
* defining the material's appearance. Any property of the material
22+
* (including any property from inherited materials) can be passed
23+
* in here. Color values can be passed any type of value accepted
24+
* by {@link Color#set}.
25+
*/
626
constructor( parameters ) {
727

828
super();
929

30+
/**
31+
* This flag can be used for type testing.
32+
*
33+
* @type {boolean}
34+
* @readonly
35+
* @default true
36+
*/
1037
this.isLineBasicMaterial = true;
1138

1239
this.type = 'LineBasicMaterial';
1340

41+
/**
42+
* Color of the material.
43+
*
44+
* @type {Color}
45+
* @default (1,1,1)
46+
*/
1447
this.color = new Color( 0xffffff );
1548

49+
/**
50+
* Sets the color of the lines using data from a texture. The texture map
51+
* color is modulated by the diffuse `color`.
52+
*
53+
* @type {?Texture}
54+
* @default null
55+
*/
1656
this.map = null;
1757

58+
/**
59+
* Controls line thickness or lines.
60+
*
61+
* Can only be used with {@link SVGRenderer}. WebGL and WebGPU
62+
* ignore this setting and always render line primitves with a
63+
* width of one pixel.
64+
*
65+
* @type {number}
66+
* @default 1
67+
*/
1868
this.linewidth = 1;
69+
70+
/**
71+
* Defines appearance of line ends.
72+
*
73+
* Can only be used with {@link SVGRenderer}.
74+
*
75+
* @type {('butt'|'round'|'square')}
76+
* @default 'round'
77+
*/
1978
this.linecap = 'round';
79+
80+
/**
81+
* Defines appearance of line joints.
82+
*
83+
* Can only be used with {@link SVGRenderer}.
84+
*
85+
* @type {('round'|'bevel'|'miter')}
86+
* @default 'round'
87+
*/
2088
this.linejoin = 'round';
2189

90+
/**
91+
* Whether the material is affected by fog or not.
92+
*
93+
* @type {boolean}
94+
* @default true
95+
*/
2296
this.fog = true;
2397

2498
this.setValues( parameters );
2599

26100
}
27101

28-
29102
copy( source ) {
30103

31104
super.copy( source );

src/materials/LineDashedMaterial.js

+52
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,68 @@
11
import { LineBasicMaterial } from './LineBasicMaterial.js';
22

3+
/**
4+
* A material for rendering line primitives.
5+
*
6+
* Materials define the appearance of renderable 3D objects.
7+
*
8+
* ```js
9+
* const material = new THREE.LineDashedMaterial( {
10+
* color: 0xffffff,
11+
* scale: 1,
12+
* dashSize: 3,
13+
* gapSize: 1,
14+
* } );
15+
* ```
16+
*
17+
* @augments LineBasicMaterial
18+
*/
319
class LineDashedMaterial extends LineBasicMaterial {
420

21+
/**
22+
* Constructs a new line dashed material.
23+
*
24+
* @param {Object} parameters - An object with one or more properties
25+
* defining the material's appearance. Any property of the material
26+
* (including any property from inherited materials) can be passed
27+
* in here. Color values can be passed any type of value accepted
28+
* by {@link Color#set}.
29+
*/
530
constructor( parameters ) {
631

732
super();
833

34+
/**
35+
* This flag can be used for type testing.
36+
*
37+
* @type {boolean}
38+
* @readonly
39+
* @default true
40+
*/
941
this.isLineDashedMaterial = true;
1042
this.type = 'LineDashedMaterial';
1143

44+
/**
45+
* The scale of the dashed part of a line.
46+
*
47+
* @type {number}
48+
* @default 1
49+
*/
1250
this.scale = 1;
51+
52+
/**
53+
* The size of the dash. This is both the gap with the stroke.
54+
*
55+
* @type {number}
56+
* @default 3
57+
*/
1358
this.dashSize = 3;
59+
60+
/**
61+
* The size of the gap.
62+
*
63+
* @type {number}
64+
* @default 1
65+
*/
1466
this.gapSize = 1;
1567

1668
this.setValues( parameters );

src/materials/Material.js

+7
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,13 @@ class Material extends EventDispatcher {
536536

537537
}
538538

539+
/**
540+
* This method can be used to set default values from parameter objects.
541+
* It is a generic implementation so it can be used with different types
542+
* of materials.
543+
*
544+
* @param {Object} values - The material values to set.
545+
*/
539546
setValues( values ) {
540547

541548
if ( values === undefined ) return;

0 commit comments

Comments
 (0)