Skip to content

editor › Globals › TextureDrawer

Class: TextureDrawer

Hierarchy

  • TextureDrawer

↳ CutoutTextureDrawer

↳ EngravingTextureDrawer

Index

Constructors

Properties

Methods

Constructors

constructor

+ new TextureDrawer(plate: Plate, ornaments: Ornament[], polygon: MultiPolygon, plateCoordinatesToTexturize: AABB, canvas: HTMLCanvasElement, mirrorX: boolean): TextureDrawer

Defined in src/model/visualization/textures/TextureDrawer.ts:172

Creates a texture drawer

Parameters:

Name Type Default Description
plate Plate - the Plate object
ornaments Ornament[] - the ornaments that should be drawn
polygon MultiPolygon - the plate polygon
plateCoordinatesToTexturize AABB - the plate coordinate area that needs to be texturized
canvas HTMLCanvasElement null (optional) the canvas to re-use
mirrorX boolean false (optional) renders the image mirrored in x direction (left <-> right), default is false

Returns: TextureDrawer

Properties

Protected canvas

• canvas: HTMLCanvasElement

Defined in src/model/visualization/textures/TextureDrawer.ts:167


Protected context

• context: CanvasRenderingContext2D

Defined in src/model/visualization/textures/TextureDrawer.ts:170


Protected mirrorX

• mirrorX: boolean

Defined in src/model/visualization/textures/TextureDrawer.ts:168


Protected ornaments

• ornaments: Ornament[]

Defined in src/model/visualization/textures/TextureDrawer.ts:163


Protected outline

• outline: Outline

Defined in src/model/visualization/textures/TextureDrawer.ts:171


Protected plate

• plate: Plate

Defined in src/model/visualization/textures/TextureDrawer.ts:165


Protected plateCoordinatesToTexturize

• plateCoordinatesToTexturize: AABB

Defined in src/model/visualization/textures/TextureDrawer.ts:164


Protected polygon

• polygon: MultiPolygon

Defined in src/model/visualization/textures/TextureDrawer.ts:166


Protected texture

• texture: Texture

Defined in src/model/visualization/textures/TextureDrawer.ts:172


Protected textureEnlargementVector

• textureEnlargementVector: Vector3

Defined in src/model/visualization/textures/TextureDrawer.ts:169

Methods

Protected _clearCanvas

▸ _clearCanvas(): void

Defined in src/model/visualization/textures/TextureDrawer.ts:246

Prepare the canvas for drawing a new texture on it. Override in sub class if you need other initialization

Returns: void


Protected _drawCuttingOrnaments

▸ _drawCuttingOrnaments(plateCoordinatesToTexturize: AABB): void

Defined in src/model/visualization/textures/TextureDrawer.ts:261

To be overridden by subclass if required

Parameters:

Name Type
plateCoordinatesToTexturize AABB

Returns: void


Protected _drawDrawableOrnaments

▸ _drawDrawableOrnaments(plateCoordinatesToTexturize: AABB): void

Defined in src/model/visualization/textures/TextureDrawer.ts:254

To be overridden by subclass if required

Parameters:

Name Type
plateCoordinatesToTexturize AABB

Returns: void


getTexture

▸ getTexture(): Texture

Defined in src/model/visualization/textures/TextureDrawer.ts:207

Draws the instance's ornaments onto a newly created THREE.Texture

Returns: Texture


Static Protected _cleanUpAsyncDrawCall

▸ _cleanUpAsyncDrawCall(canvas: any, cancelFn: any): void

Defined in src/model/visualization/textures/TextureDrawer.ts:153

Parameters:

Name Type
canvas any
cancelFn any

Returns: void


Static _drawCoordinateSystem

▸ _drawCoordinateSystem(context: any): void

Defined in src/model/visualization/textures/TextureDrawer.ts:29

Parameters:

Name Type
context any

Returns: void


Static _getCanvas

▸ _getCanvas(width: number, height: number, canvas: HTMLCanvasElement): HTMLCanvasElement

Defined in src/model/visualization/textures/TextureDrawer.ts:96

Gets a canvas with the supplied width and height. It may be created or reuse the existing one.

Parameters:

Name Type Description
width number the desired width of the canvas
height number the desired height of the canvas
canvas HTMLCanvasElement (optional) a canvas to reuse

Returns: HTMLCanvasElement

a canvas with the supplied width and height


Static _getCanvasParams

▸ _getCanvasParams(uvMin: any, uvMax: any, resolution: any, maxTextureSize: number): object

Defined in src/model/visualization/textures/TextureDrawer.ts:67

Parameters:

Name Type Default
uvMin any -
uvMax any -
resolution any -
maxTextureSize number 4096

Returns: object

  • height: any = sizeY

  • scaleX: number

  • scaleY: number

  • width: number = sizeX


Static Protected _saveAsyncDrawCall

▸ _saveAsyncDrawCall(canvas: any, cancelFn: any): void

Defined in src/model/visualization/textures/TextureDrawer.ts:140

Parameters:

Name Type
canvas any
cancelFn any

Returns: void


Static cancelAsyncDrawCalls

▸ cancelAsyncDrawCalls(canvas: any): void

Defined in src/model/visualization/textures/TextureDrawer.ts:124

Parameters:

Name Type
canvas any

Returns: void