Перейти к основному содержанию

Class: ScreenLines

Около 2 мин

Class: ScreenLines

Represents one or more line segments that can have different color, width, screen scaling. Has high rendering performance.

Hierarchy

  • LineSegments2

    ScreenLines

Constructors

constructor

new ScreenLines(maxCount?, material?): ScreenLines

Parameters

NameTypeDescription
maxCount?numberMaximum line segments count. Can`t be changed after creation.
material?ScreenLinesMaterialLine Material. If not specified, the default material will be used.

Returns

ScreenLines

Overrides

LineSegments2.constructor

Properties

maxCount

Readonly maxCount: number

Maximum line segments count. Set when creating an instance of the class.

Methods

fill

fill(color?): this

Fills the memory array for the line segments declared at creation with the default parameters (color).

Parameters

NameTypeDescription
color?ColorRepresentationDefault line segment points color.

Returns

this


fromEdgesGeometry

fromEdgesGeometry(geometry): this

Writes edges data to a lines memory array from wireframe geometry.

Parameters

NameTypeDescription
geometryEdgesGeometry<BufferGeometry<NormalBufferAttributes>>Geometry object.

Returns

this


fromLineSegments

fromLineSegments(lineSegments): this

Writes line segments data to a lines memory array from line segments object.

Parameters

NameTypeDescription
lineSegmentsLineSegments<BufferGeometry<NormalBufferAttributes>, Material | Material[], Object3DEventMap>Line segments object.

Returns

this


fromMesh

fromMesh(mesh): this

Writes mesh data to a lines memory array from wireframe geometry.

Parameters

NameTypeDescription
meshMesh<BufferGeometry<NormalBufferAttributes>, Material | Material[], Object3DEventMap>Mesh object.

Returns

this


fromWireframeGeometry

fromWireframeGeometry(geometry): this

Writes wireframe data to a lines memory array from wireframe geometry.

Parameters

NameTypeDescription
geometryWireframeGeometry<BufferGeometry<NormalBufferAttributes>>Geometry object.

Returns

this


getLinesCount

getLinesCount(): number

Get visible line segments count.

Returns

number


push

push(startPosition, endPosition, startColor?, endColor?): this

Writes the new line segments data to the lines memory array.

Parameters

NameTypeDescription
startPositionnumber[] | Vector3Line start coordinates.
endPositionnumber[] | Vector3Line start coordinates.
startColor?ColorRepresentationLine start color.
endColor?ColorRepresentationLine start color.

Returns

this


setColorAtIndex

setColorAtIndex(index, startColor, endColor): this

Set Line segment colors at index.

Parameters

NameTypeDescription
indexnumberLine index.
startColorColorRepresentationStart line color.
endColorColorRepresentationStart line color.

Returns

this


setColors

setColors(array): this

Bach set line segments colors.

Parameters

NameTypeDescription
arrayFloat32Array | ArrayLike<number>Line colors array by start and end color components [startR,startG,startB,endR,endG,endB].

Returns

this


setLinesCount

setLinesCount(count): void

Set visible line segments count.

Parameters

NameTypeDescription
countnumberLines count.

Returns

void


setPositionAtIndex

setPositionAtIndex(index, startPosition, endPosition): this

Set Line segment positions at index.

Parameters

NameTypeDescription
indexnumberLine index.
startPositionnumber[] | Vector3Start line position.
endPositionnumber[] | Vector3Start line position.

Returns

this


setPositions

setPositions(array): this

Bach set lines positions.

Parameters

NameTypeDescription
arrayFloat32Array | ArrayLike<number>Line positions array by start and end coordinate components [startX,startY,startZ,endX,endY,endZ].

Returns

this