Skip to content

editorGlobalsDebugRenderingHelper

Class: DebugRenderingHelper

Helper class for adding simple geometry (points, lines) to a given three object. Helper class for debugging polygons.

Hierarchy

  • DebugRenderingHelper

Index

Constructors

Properties

Methods

Constructors

constructor

+ new DebugRenderingHelper(threeNode: any): DebugRenderingHelper

Defined in src/util/DebugRenderingHelper.ts:103

Parameters:

Name Type
threeNode any

Returns: DebugRenderingHelper

Properties

Private Readonly debugObjects

debugObjects: Map‹string, Object3D[]› = new Map()

Defined in src/util/DebugRenderingHelper.ts:103


Private threeNode

threeNode: Object3D

Defined in src/util/DebugRenderingHelper.ts:102


Static Private Readonly colorMaterialCache

colorMaterialCache: Map‹string, MeshBasicMaterial‹›› = new Map()

Defined in src/util/DebugRenderingHelper.ts:30

for each color (represented by it's hex string), a simple material for it (do not modify the objects stored in the cache!)


Static Private Readonly cylinderGeometry

cylinderGeometry: CylinderBufferGeometry‹› = new CylinderBufferGeometry(1, 1, 1, 8)

Defined in src/util/DebugRenderingHelper.ts:24


Static Private Readonly planeGeometry

planeGeometry: PlaneBufferGeometry‹› = new PlaneBufferGeometry(200, 200)

Defined in src/util/DebugRenderingHelper.ts:25


Static Private Readonly sphereGeometry

sphereGeometry: SphereBufferGeometry‹› = new SphereBufferGeometry(1, 16, 16)

Defined in src/util/DebugRenderingHelper.ts:23

Methods

addDebugObject

addDebugObject(threeObject: Object3D, context: string): Object3D

Defined in src/util/DebugRenderingHelper.ts:150

Add a ThreeJS mesh to the current scene for debugging purposes

Parameters:

Name Type Default Description
threeObject Object3D - containing geometry that will be added to the scene
context string "debug" the context of the debug object

Returns: Object3D


clearDebugObjects

clearDebugObjects(): void

Defined in src/util/DebugRenderingHelper.ts:179

Remove all currently displayed debug objects

Returns: void


debugLine

debugLine(positions: Vector3[] | Line3, color?: ColorInput, context?: string): void

Defined in src/util/DebugRenderingHelper.ts:210

Add a cylinder of random color (per call) at the given positions

Parameters:

Name Type Description
positions Vector3[] | Line3 start and end position in the coordinate system of this.threeNode
color? ColorInput (optional) in a format that ThreeJS accepts, e.g. 0xff0000
context? string -

Returns: void


debugLines

debugLines(lines: Vector3[][], color?: ColorInput, context?: string): void

Defined in src/util/DebugRenderingHelper.ts:218

Parameters:

Name Type Description
lines Vector3[][] array of points lists in the coordinate system of this.threeNode
color? ColorInput in color format aka 0xff0000
context? string -

Returns: void


debugPlane

debugPlane(plane: Plane, color?: ColorInput, context?: string): void

Defined in src/util/DebugRenderingHelper.ts:224

Parameters:

Name Type
plane Plane
color? ColorInput
context? string

Returns: void


debugPoint

debugPoint(position: Vector3, color?: ColorInput, context?: string): void

Defined in src/util/DebugRenderingHelper.ts:188

Add a sphere of random color (per call) at the given position

Parameters:

Name Type Description
position Vector3 point in the coordinate system of this.threeNode
color? ColorInput -
context? string -

Returns: void


debugPoints

debugPoints(positions: Vector3[], color?: ColorInput, context?: string): void

Defined in src/util/DebugRenderingHelper.ts:198

Add a sphere of random color (per call) at the given positions

Parameters:

Name Type Description
positions Vector3[] list of points in the coordinate system of this.threeNode
color? ColorInput (optional) in a format that ThreeJS accepts, e.g. 0xff0000
context? string -

Returns: void


initialize

initialize(): void

Defined in src/util/DebugRenderingHelper.ts:112

this should only be called for the DebugRenderingHelper of the RenderContext

Returns: void


removeDebugObjects

removeDebugObjects(context?: string): this

Defined in src/util/DebugRenderingHelper.ts:162

Remove all debug objects with the given context. If no context is given, remove all.

Parameters:

Name Type
context? string

Returns: this


setThreeNode

setThreeNode(threeNode: Object3D, keepObjects: boolean): void

Defined in src/util/DebugRenderingHelper.ts:129

Parameters:

Name Type Default
threeNode Object3D -
keepObjects boolean true

Returns: void


toOFF

toOFF(polygons: VectorPolygon3D[]): string

Defined in src/util/DebugRenderingHelper.ts:141

Parameters:

Name Type
polygons VectorPolygon3D[]

Returns: string


Static Private _getCachedColorMaterial

_getCachedColorMaterial(colorInput?: ColorInput, doubleSided?: boolean): MeshBasicMaterial

Defined in src/util/DebugRenderingHelper.ts:87

Parameters:

Name Type
colorInput? ColorInput
doubleSided? boolean

Returns: MeshBasicMaterial


Static Private _getColor

_getColor(colorInput?: ColorInput): Color

Defined in src/util/DebugRenderingHelper.ts:77

Parameters:

Name Type
colorInput? ColorInput

Returns: Color


Static debugSvg

debugSvg(groupLabel: string, mainPolygon: Polygon | MultiPolygon, sidePolygons: Array‹object›, debugLevel: typeof DebugLevel, includeSize: boolean): void

Defined in src/util/PolygonDebugHelper.ts:19

Uses debugLevel to log the polygons to console (rendering + svgstring as data url) Group titles don't get filtered in the console, so avoid spamming (ie don't use the standard DebugLevel).

Parameters:

Name Type Default Description
groupLabel string "" Output will be grouped with this label
mainPolygon Polygon | MultiPolygon - The main polygon defines the view port, will be rendered black
sidePolygons Array‹object› [] Additional polygons to rendered into the same svg, each can have a own color, defaults to red.
debugLevel typeof DebugLevel - Use this DebugLevel instance
includeSize boolean true -

Returns: void


Static downloadSvg

downloadSvg(groupLabel: string, mainPolygon: Polygon | MultiPolygon, sidePolygons: Array‹object›, debugLevel: typeof DebugLevel, includeSize: boolean): void

Defined in src/util/PolygonDebugHelper.ts:71

Uses debugLevel to download polygons (rendering + svgstring as data url) Group titles don't get filtered in the console, so avoid spamming (ie don't use the standard DebugLevel).

Parameters:

Name Type Default Description
groupLabel string "1" Output will be grouped with this label
mainPolygon Polygon | MultiPolygon - The main polygon defines the view port, will be rendered black
sidePolygons Array‹object› [] Additional polygons to rendered into the same svg, each can have a own color, defaults to red.
debugLevel typeof DebugLevel - Use this DebugLevel instance
includeSize boolean true -

Returns: void


Static renderLine

renderLine(positions: Vector3[] | Line3, thickness: number, color?: ColorInput): Mesh

Defined in src/util/DebugRenderingHelper.ts:36

This renders a line as a cylinder with 8 sides. It returns a three js Mesh, to make it visible, you have to add it to a threeNode.

Parameters:

Name Type
positions Vector3[] | Line3
thickness number
color? ColorInput

Returns: Mesh


Static renderPlane

renderPlane(plane: Plane, color?: ColorInput): Mesh

Defined in src/util/DebugRenderingHelper.ts:70

Parameters:

Name Type
plane Plane
color? ColorInput

Returns: Mesh


Static renderPoint

renderPoint(position: Vector3, thickness: number, color?: ColorInput): Mesh

Defined in src/util/DebugRenderingHelper.ts:61

Add a sphere of random color (per call) at the given position

Parameters:

Name Type Description
position Vector3 point in the coordinate system of this.threeNode
thickness number -
color? ColorInput -

Returns: Mesh