-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs: Document the examples/jsm/lines components. (#1257)
* Docs: Document the examples/jsm/lines components. * Format
- Loading branch information
1 parent
946702e
commit 6e54c7f
Showing
5 changed files
with
169 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,37 @@ | ||
import { Mesh } from "three"; | ||
import { Mesh, WebGLRenderer } from "three"; | ||
|
||
import { LineMaterial } from "./LineMaterial.js"; | ||
import { LineSegmentsGeometry } from "./LineSegmentsGeometry.js"; | ||
|
||
/** | ||
* 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. The {@link Line2} extends this object, forming a polyline instead of individual segments. | ||
*/ | ||
export class LineSegments2 extends Mesh { | ||
geometry: LineSegmentsGeometry; | ||
material: LineMaterial; | ||
|
||
constructor(geometry?: LineSegmentsGeometry, material?: LineMaterial); | ||
/** | ||
* Read-only flag to check if a given object is of type LineSegments2. | ||
*/ | ||
readonly isLineSegments2: true; | ||
|
||
/** | ||
* @param geometry (optional) Pair(s) of vertices representing each line segment. | ||
* @param material (optional) Material for the line. Default is a {@link LineMaterial} with random color. | ||
*/ | ||
constructor(geometry?: LineSegmentsGeometry, material?: LineMaterial); | ||
|
||
computeLineDistances(): this; | ||
|
||
/** | ||
* 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 [layers]{@link Object3D.layers} or | ||
* [visible]{@link Object3D.visible}), you must call this manually whenever the viewport changes. | ||
* @param renderer | ||
*/ | ||
onBeforeRender(renderer: WebGLRenderer): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,53 @@ | ||
import { EdgesGeometry, InstancedBufferGeometry, LineSegments, Matrix4, Mesh, WireframeGeometry } from "three"; | ||
import { EdgesGeometry, InstancedBufferGeometry, LineSegments, Mesh, WireframeGeometry } from "three"; | ||
|
||
/** | ||
* A series of vertex pairs, forming line segments. | ||
* | ||
* This is used in {@link LineSegments2} to describe the shape. | ||
*/ | ||
export class LineSegmentsGeometry extends InstancedBufferGeometry { | ||
constructor(); | ||
/** | ||
* Read-only flag to check if a given object is of type LineSegmentsGeometry. | ||
*/ | ||
readonly isLineSegmentsGeometry: true; | ||
|
||
applyMatrix4(matrix: Matrix4): this; | ||
computeBoundingBox(): void; | ||
computeBoundingSphere(): void; | ||
/** | ||
* Creates a new geometry. Call [setPositions]{@link LineSegmentsGeometry.setPositions} to add segments. | ||
*/ | ||
constructor(); | ||
|
||
/** | ||
* Replace the vertex positions with a new set. The array can be an `Array` or `Float32Array`. The length must be a | ||
* multiple of six. | ||
* @param array | ||
*/ | ||
setPositions(array: number[] | Float32Array): this; | ||
|
||
/** | ||
* Replace the per-vertex colors. Every sixtuple describes a segment: `[r1, g1, b1, r2, g2, b2]`. The array can be | ||
* an `Array` or `Float32Array`. | ||
* @param array | ||
*/ | ||
setColors(array: number[] | Float32Array): this; | ||
|
||
/** | ||
* Copy the vertex positions of a wireframe geometry into this geometry. | ||
*/ | ||
fromWireframeGeometry(geometry: WireframeGeometry): this; | ||
|
||
/** | ||
* Copy the vertex positions of an edge geometry into this geometry. | ||
*/ | ||
fromEdgesGeometry(geometry: EdgesGeometry): this; | ||
fromLineSegments(lineSegments: LineSegments): this; | ||
|
||
/** | ||
* Copy the vertex positions of a mesh object into this geometry. | ||
*/ | ||
fromMesh(mesh: Mesh): this; | ||
fromWireframeGeometry(geometry: WireframeGeometry): this; | ||
setColors(array: number[] | Float32Array): this; | ||
setPositions(array: number[] | Float32Array): this; | ||
|
||
/** | ||
* Copy the vertex positions of a {@link LineSegments} object into this geometry. Assumes the source geometry is not | ||
* using indices. | ||
*/ | ||
fromLineSegments(lineSegments: LineSegments): this; | ||
} |