Class BuilderPart

Manage parts or sections to be built into a model

Constructors

Properties

extraAttributes?: extraAttributes

This is an extremely advanced feature, and allows you to add custom attributes to the part You will need to understand how to use twgl.js to use this feature at the createBufferInfoFromArrays function

material: Material
name: string

Accessors

  • set customArrayData(array: Arrays): void
  • This is a very advanced feature, and allows you to provide your own twgl.Arrays This is useful for creating custom renderables from existing data

    Parameters

    • array: Arrays

      The twgl.Arrays to use for the renderable

    Returns void

Methods

  • Add a two triangle quad to the renderable part Each quad must be defined by 4 vertices and will get a normal calculated Each quad will get a unique normal, so no smooth shading

    Parameters

    • v1: XYZ

      Vertex 1 of the quad

    • v2: XYZ

      Vertex 2 of the quad

    • v3: XYZ

      Vertex 3 of the quad

    • v4: XYZ

      Vertex 4 of the quad

    • tc1: number[] = ...

      UV texture coordinate for vertex 1

    • tc2: number[] = ...

      UV texture coordinate for vertex 2

    • tc3: number[] = ...

      UV texture coordinate for vertex 3

    • tc4: number[] = ...

      UV texture coordinate for vertex 4

    Returns void

  • Add a triangle to the renderable part Each triangle must be defined by 3 vertices and will get a normal calculated Each triangle will get a unique normal, so no smooth shading

    Parameters

    • v1: XYZ

      Vertex 1 of the triangle

    • v2: XYZ

      Vertex 2 of the triangle

    • v3: XYZ

      Vertex 3 of the triangle

    • tc1: number[] = ...

      Texture coordinate for vertex 1

    • tc2: number[] = ...

      Texture coordinate for vertex 2

    • tc3: number[] = ...

      Texture coordinate for vertex 3

    Returns void

  • Build the part from the data added and turn into a twgl.BufferInfo

    Parameters

    • gl: WebGL2RenderingContext

      A WebGL2 rendering context

    Returns null | BufferInfo

    BufferInfo used by twgl