Skip to content

editorGlobalsPlateRenderSurfaceExtruder

Class: PlateRenderSurfaceExtruder

Based on a 2d outline specified as a number of (x,y)-points, this class triangulates the surface, extrudes it by the specified amount, and creates additional backing and optionally in-between surfaces Since it is supposed to work with any framework, Vectors are simple {x, y, (z)} objects.

Hierarchy

  • PlateRenderSurfaceExtruder

Index

Methods

Methods

Static Private _generateHoleSideSurfaces

_generateHoleSideSurfaces(surface: PlateRenderSurface, clone: PlateRenderSurface, movingUp: boolean, surfaceDescriptionMode: PlateRenderSurfaceDescriptionMode): PlateRenderSurface[]

Defined in src/util/PlateRenderSurfaceExtruder.ts:153

Parameters:

Name Type
surface PlateRenderSurface
clone PlateRenderSurface
movingUp boolean
surfaceDescriptionMode PlateRenderSurfaceDescriptionMode

Returns: PlateRenderSurface[]


Static Private _generateOutlineSideSurface

_generateOutlineSideSurface(surface: PlateRenderSurface, clone: PlateRenderSurface, movingUp: boolean, surfaceDescriptionMode: PlateRenderSurfaceDescriptionMode): PlateRenderSurface

Defined in src/util/PlateRenderSurfaceExtruder.ts:186

Parameters:

Name Type
surface PlateRenderSurface
clone PlateRenderSurface
movingUp boolean
surfaceDescriptionMode PlateRenderSurfaceDescriptionMode

Returns: PlateRenderSurface


Static Private _generateSideSurface

_generateSideSurface(upperVertices: PlateRenderSurfaceVertex[], lowerVertices: PlateRenderSurfaceVertex[], startIndex: number, endIndex: number, surfaceDescriptionMode: PlateRenderSurfaceDescriptionMode): PlateRenderSurface

Defined in src/util/PlateRenderSurfaceExtruder.ts:209

Parameters:

Name Type
upperVertices PlateRenderSurfaceVertex[]
lowerVertices PlateRenderSurfaceVertex[]
startIndex number
endIndex number
surfaceDescriptionMode PlateRenderSurfaceDescriptionMode

Returns: PlateRenderSurface


Static extrudeAlongNormals

extrudeAlongNormals(surface: PlateRenderSurface, distance: number, reverseNormals: boolean, outlineSurfaceDescriptionMode: PlateRenderSurfaceDescriptionMode | null, holeSurfaceDescriptionMode: PlateRenderSurfaceDescriptionMode | null): IExtrusionResult

Defined in src/util/PlateRenderSurfaceExtruder.ts:110

Extrude (clone + offset) the given surface along it's normals. In order for this to work, you will have to attach normalized normals to the surface before {@see attachNormals}

Parameters:

Name Type Default Description
surface PlateRenderSurface - The surface to extrude
distance number - How far to extrude the surface
reverseNormals boolean false Whether the surface should be flipped, used to generate a matching bottom face. If set, normals will be inverted and triangles will be reversed.
outlineSurfaceDescriptionMode PlateRenderSurfaceDescriptionMode | null null Set a surface description mode if outline side surfaces should be generated.
holeSurfaceDescriptionMode PlateRenderSurfaceDescriptionMode | null null Set a surface description mode if hole side surfaces should be generated.

Returns: IExtrusionResult


Static extrudeByDirection

extrudeByDirection(surface: PlateRenderSurface, direction: ExtrusionDirection, distance: number, reverseNormals: boolean, outlineSurfaceDescriptionMode: PlateRenderSurfaceDescriptionMode | null, holeSurfaceDescriptionMode: PlateRenderSurfaceDescriptionMode | null): IExtrusionResult

Defined in src/util/PlateRenderSurfaceExtruder.ts:66

Apply an extrusion described by an ExtrusionDirection to the surface. Will return the resulting other surfaces and change the given surface if required (when BOTH is the given direction). The orientation of the given surface will not get changed (ie the normal might point inwards when direction is UP), you must handle this (eg by reversing the surface beforehand and use DOWN). The hole and outline sides however are pointing outwards. Will pass most parameters to extrudeAlongNormals.

Parameters:

Name Type Default
surface PlateRenderSurface -
direction ExtrusionDirection -
distance number -
reverseNormals boolean false
outlineSurfaceDescriptionMode PlateRenderSurfaceDescriptionMode | null null
holeSurfaceDescriptionMode PlateRenderSurfaceDescriptionMode | null null

Returns: IExtrusionResult


Static generateSideUv

generateSideUv(sideSurface: PlateRenderSurface): Float32Array

Defined in src/util/PlateRenderSurfaceExtruder.ts:46

Generates texture coordinates for the side, ranging from 0 (bottom) to 1 in height, and scaled to make the actual length distances match the "real world" width of the texture

Parameters:

Name Type
sideSurface PlateRenderSurface

Returns: Float32Array