diff --git a/docs/api/en/materials/LineBasicMaterial.html b/docs/api/en/materials/LineBasicMaterial.html index 8efaf0b1be3fd4..3f24c3b601a688 100644 --- a/docs/api/en/materials/LineBasicMaterial.html +++ b/docs/api/en/materials/LineBasicMaterial.html @@ -69,7 +69,9 @@

[property:Float linewidth]

Due to limitations of the [link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile] with the [page:WebGLRenderer WebGL] renderer on most - platforms linewidth will always be `1` regardless of the set value. + platforms linewidth will always be `1` regardless of the set value.

+ + If you need wider lines, consider using [page:Line2] or [page:LineSegments2] with [page:LineMaterial].

[property:String linecap]

diff --git a/docs/examples/en/lines/Line2.html b/docs/examples/en/lines/Line2.html new file mode 100644 index 00000000000000..41c484d2a7690a --- /dev/null +++ b/docs/examples/en/lines/Line2.html @@ -0,0 +1,65 @@ + + + + + + + + + + [page:Object3D] → [page:Mesh] → [page:LineSegments2] → + +

[name]

+ +

+ A polyline drawn between vertices. +

+ +

+ This adds functionality beyond [page:Line], like arbitrary line width and changing width to be in world units. + It extends [page:LineSegments2], simplifying constructing segments from a chain of points. +

+ +

Import

+ +

+ [name] is an add-on, and therefore must be imported explicitly. + See [link:#manual/introduction/Installation Installation / Addons]. +

+ + + import { Line2 } from 'three/addons/lines/Line2.js'; + + +

Examples

+ +

+ [example:webgl_lines_fat WebGL / lines / fat ]
+ [example:webgl_lines_fat_raycasting WebGL / lines / fat / raycasting ]
+ [example:webgpu_lines_fat WebGPU / lines / fat / raycasting ] +

+ +

Constructor

+ +

[name]( [param:LineGeometry geometry], [param:LineMaterial material] )

+

+ [page:LineGeometry geometry] — (optional) Pair(s) of vertices representing each line segment.
+ [page:Material material] — (optional) Material for the line. Default is a [page:LineMaterial] with random color. +

+ +

Properties

+

See the base [page:LineSegments2] class for common properties.

+ +

[property:Boolean isLine2]

+

Read-only flag to check if a given object is of type [name].

+ +

Methods

+

See the base [page:LineSegments2] class for common methods.

+ +

Source

+ +

+ [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/Line2.js examples/jsm/lines/Line2.js] +

+ + diff --git a/docs/examples/en/lines/LineGeometry.html b/docs/examples/en/lines/LineGeometry.html new file mode 100644 index 00000000000000..d1a3ff370e036d --- /dev/null +++ b/docs/examples/en/lines/LineGeometry.html @@ -0,0 +1,84 @@ + + + + + + + + + + [page:BufferGeometry] → [page:InstancedBufferGeometry] → [page:LineSegmentsGeometry] → + +

[name]

+ +

+ A chain of vertices, forming a polyline. +

+ +

+ This is used in [page:Line2] to describe the shape. +

+ +

Import

+ +

+ [name] is an add-on, and therefore must be imported explicitly. + See [link:#manual/introduction/Installation Installation / Addons]. +

+ + + import { LineGeometry } from 'three/addons/lines/LineGeometry.js'; + + +

Examples

+ +

+ [example:webgl_lines_fat WebGL / lines / fat ]
+ [example:webgl_lines_fat_raycasting WebGL / lines / fat / raycasting ]
+ [example:webgpu_lines_fat WebGPU / lines / fat / raycasting ] +

+ +

Constructor

+ +

[name]()

+

+ Creates a new geometry. + Call [page:LineGeometry.setPositions setPositions] to add segments. +

+ +

Properties

+

See the base [page:LineSegmentsGeometry] class for common properties.

+ +

[property:Boolean isLineGeometry]

+

Read-only flag to check if a given object is of type [name].

+ +

Methods

+

See the base [page:LineSegmentsGeometry] class for common methods.

+ +

[method:this fromLine]( [param:Line line] )

+

+ Copy the vertex positions of a [page:Line] object into this geometry. + Assumes the source geometry is not using indices. +

+ +

[method:this setColors]( [param:Array array] )

+

+ Replace the per-vertex colors. + Every triple describes a line vertex: `[r1, g1, b1]`. + The array can be an `Array` or `Float32Array`. +

+ +

[method:this setPositions]( [param:Array array] )

+

+ Replace the vertex positions with a new set. + The array can be an `Array` or `Float32Array`. + The length must be a multiple of three. +

+ +

Source

+ +

+ [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/LineGeometry.js examples/jsm/lines/LineGeometry.js] +

+ + diff --git a/docs/examples/en/lines/LineMaterial.html b/docs/examples/en/lines/LineMaterial.html new file mode 100644 index 00000000000000..d988ad641df6d6 --- /dev/null +++ b/docs/examples/en/lines/LineMaterial.html @@ -0,0 +1,92 @@ + + + + + + + + + + [page:Material] → [page:ShaderMaterial] → + +

[name]

+ +

+ A material for drawing wireframe-style geometries. + Unlike [page:LineBasicMaterial], it supports arbitrary line widths and allows using world units instead of screen space units. + This material is used with [page:LineSegments2] and [page:Line2]. +

+ +

+ Lines are always rendered with round caps and round joints. +

+ +

Examples

+

+ [example:webgl_lines_fat WebGL / lines / fat ]
+ [example:webgl_lines_fat_raycasting WebGL / lines / fat / raycasting ]
+ [example:webgl_lines_fat_wireframe WebGL / lines / fat / wireframe ]
+ [example:webgpu_lines_fat WebGPU / lines / fat / raycasting ] +

+ +

Constructor

+

[name]( [param:Object parameters] )

+ +

+ [page:Object parameters] - (optional) an object with one or more properties defining the material's appearance. + Any property of the material (including any property inherited from [page:ShaderMaterial]) can be passed in here. +

+ +

+ The exception is the property [page:Hexadecimal color], which can be passed in as a number or hexadecimal string and is `0xffffff` (white) by default. + [page:Color.set]( color ) is called internally. +

+ +

Properties

+

See the base [page:ShaderMaterial] class for common properties.

+ +

[property:Color color]

+

[page:Color] of the material, by default set to white (0xffffff).

+ +

[property:Boolean dashed]

+

Whether the line is dashed, or solid. Default is `false`.

+ +

[property:number dashOffset]

+

Where in the dash cycle the dash starts. Default is `0`.

+ +

[property:number dashScale]

+

The scale of the dashes and gaps. Default is `1`.

+ +

[property:number dashSize]

+

The size of the dash. Default is `1`.

+ +

[property:number gapSize]

+

The size of the gap. Default is `1`.

+ +

[property:Float linewidth]

+

Controls line thickness. Default is `1`.

+ +

[property:Vector2 resolution]

+

+ The size of the viewport, in screen pixels. + This must be kept updated to make screen-space rendering accurate. + The [page:LineSegments2.onBeforeRender] callback performs the update for visible objects. + Default is `[1, 1]`. +

+ +

[property:Boolean worldUnits]

+

+ Whether the material's sizes (width, dash gaps) are in world units. + Default is `false` (screen space units.) +

+ +

Methods

+

See the base [page:ShaderMaterial] class for common methods.

+ +

Source

+ +

+ [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/LineMaterial.js examples/jsm/lines/LineMaterial.js] +

+ + diff --git a/docs/examples/en/lines/LineSegments2.html b/docs/examples/en/lines/LineSegments2.html new file mode 100644 index 00000000000000..ae32f9d8d2f17c --- /dev/null +++ b/docs/examples/en/lines/LineSegments2.html @@ -0,0 +1,69 @@ + + + + + + + + + + [page:Object3D] → [page:Mesh] → + +

[name]

+ +

+ A series of lines drawn between pairs of vertices. +

+ +

+ This adds functionality beyond [page:LineSegments], like arbitrary line width and changing width to be in world units. + The [page:Line2] extends this object, forming a polyline instead of individual segments. +

+ +

Import

+ +

+ [name] is an add-on, and therefore must be imported explicitly. + See [link:#manual/introduction/Installation Installation / Addons]. +

+ + + import { LineSegments2 } from 'three/addons/lines/LineSegments2.js'; + + +

Example

+ +

[example:webgl_lines_fat_raycasting WebGL / lines / fat / raycasting ]

+ +

Constructor

+ +

[name]( [param:LineSegmentsGeometry geometry], [param:LineMaterial material] )

+

+ [page:LineSegmentsGeometry geometry] — (optional) Pair(s) of vertices representing each line segment.
+ [page:Material material] — (optional) Material for the line. Default is a [page:LineMaterial] with random color. +

+ +

Properties

+

See the base [page:Mesh] class for common properties.

+ +

[property:Boolean isLineSegments2]

+

Read-only flag to check if a given object is of type [name].

+ +

Methods

+

See the base [page:Mesh] class for common methods.

+ +

[method:undefined onBeforeRender]( [param:WebGLRenderer renderer] )

+

+ Called by the framework to update the material's resolution property, needed for screen-scaled widths. +

+

+ If your object is not visible to a camera (e.g. by [page:Object3D.layers layers] or [page:Object3D.visible visible],) you must call this manually whenever the viewport changes. +

+ +

Source

+ +

+ [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/LineSegments2.js examples/jsm/lines/LineSegments2.js] +

+ + diff --git a/docs/examples/en/lines/LineSegmentsGeometry.html b/docs/examples/en/lines/LineSegmentsGeometry.html new file mode 100644 index 00000000000000..56e81af1859ec7 --- /dev/null +++ b/docs/examples/en/lines/LineSegmentsGeometry.html @@ -0,0 +1,103 @@ + + + + + + + + + + [page:BufferGeometry] → [page:InstancedBufferGeometry] → + +

[name]

+ +

+ A series of vertex pairs, forming line segments. +

+ +

+ This is used in [page:LineSegments2] to describe the shape. +

+ +

Import

+ +

+ [name] is an add-on, and therefore must be imported explicitly. + See [link:#manual/introduction/Installation Installation / Addons]. +

+ + + import { LineSegmentsGeometry } from 'three/addons/lines/LineSegmentsGeometry.js'; + + +

Example

+ +

[example:webgl_lines_fat_raycasting WebGL / lines / fat / raycasting ]

+ +

Constructor

+ +

[name]()

+

+ Creates a new geometry. + Call [page:LineSegmentsGeometry.setPositions setPositions] to add segments. +

+ +

Properties

+

See the base [page:InstancedBufferGeometry] class for common properties.

+ +

[property:Boolean isLineSegmentsGeometry]

+

Read-only flag to check if a given object is of type [name].

+ +

Methods

+

See the base [page:Mesh] class for common methods.

+ +

[method:this fromEdgesGeometry]( [param:EdgesGeometry geometry] )

+

+ Copy the vertex positions of an edge geometry into this geometry. +

+ +

[method:this fromLineSegments]( [param:LineSegments lineSegments] )

+

+ Copy the vertex positions of a [page:LineSegments] object into this geometry. + Assumes the source geometry is not using indices. +

+ +

[method:this fromMesh]( [param:Mesh mesh] )

+

+ Copy the vertex positions of a mesh object into this geometry. +

+ +

[method:this fromWireframeGeometry]( [param:WireframeGeometry geometry] )

+

+ Copy the vertex positions of a wireframe geometry into this geometry. +

+ +

[method:this setColors]( [param:Array array] )

+

+ Replace the per-vertex colors. + Every sixtuple describes a segment: `[r1, g1, b1, r2, g2, b2]`. + The array can be an `Array` or `Float32Array`. +

+ +

[method:this setPositions]( [param:Array array] )

+

+ Replace the vertex positions with a new set. + The array can be an `Array` or `Float32Array`. + The length must be a multiple of six. +

+

+ See also [page:LineSegmentsGeometry.positions positions]. +

+ +

[method:undefined toJSON]()

+

+ Unimplemented. +

+ +

Source

+ +

+ [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/LineSegmentsGeometry.js examples/jsm/lines/LineSegmentsGeometry.js] +

+ + diff --git a/docs/list.json b/docs/list.json index 60293ad3703986..81426149a26793 100644 --- a/docs/list.json +++ b/docs/list.json @@ -362,6 +362,14 @@ "LightProbeGenerator": "examples/en/lights/LightProbeGenerator" }, + "Lines": { + "Line2": "examples/en/lines/Line2", + "LineGeometry": "examples/en/lines/LineGeometry", + "LineMaterial": "examples/en/lines/LineMaterial", + "LineSegments2": "examples/en/lines/LineSegments2", + "LineSegmentsGeometry": "examples/en/lines/LineSegmentsGeometry" + }, + "Loaders": { "3DMLoader": "examples/en/loaders/3DMLoader", "DRACOLoader": "examples/en/loaders/DRACOLoader", @@ -433,7 +441,7 @@ "SceneUtils": "examples/en/utils/SceneUtils", "SkeletonUtils": "examples/en/utils/SkeletonUtils" }, - + "WebXR": { "XREstimatedLight": "examples/en/webxr/XREstimatedLight" } @@ -1367,7 +1375,7 @@ "TrackballControls": "examples/ko/controls/TrackballControls", "TransformControls": "examples/ko/controls/TransformControls" }, - + "WebXR": { "XREstimatedLight": "examples/ko/webxr/XREstimatedLight" }