Legonizer

Provides functionality for generating a Lego mockup based on user-defined coordinates and scales.

Constructor

new Legonizer(view, optionsopt)

Init properties and sets up the DOM elements and scene for a planar view.

Parameters:
NameTypeAttributesDescription
viewPlanarView

Represents the 3D view or scene. Objects will be displayed and manipulated.

optionsObject<optional>

Optionals parameter. Represents the user interface element. If no parentDomElement parameter is provided, the domElement of widget is used. If no domMockUpVisualizer a default one is created

Classes

Legonizer

Members

boxSelector :Mesh.<BoxGeometry, MeshLambertMaterial, Object3DEventMap>

Type:
  • Mesh.<BoxGeometry, MeshLambertMaterial, Object3DEventMap>

buttonSelectionAreaElement :HTMLButtonElement

Type:
  • HTMLButtonElement

countLegoVec2Input :Vector2Input

Type:
  • Vector2Input

domElement :HTMLElement

Type:
  • HTMLElement

domMockUpVisualizer :HTMLElement

Type:
  • HTMLElement

legoMockupVisualizer :LegoMockupVisualizer

legoPrevisualisation :Mesh.<BoxGeometry, MeshLambertMaterial, Object3DEventMap>

Type:
  • Mesh.<BoxGeometry, MeshLambertMaterial, Object3DEventMap>

parentDomElement :HTMLElement

Type:
  • HTMLElement

positionVec3Input :Vector3Input

Type:
  • Vector3Input

ratio :number

Type:
  • number

ratioParameterLabelInput :Object

Type:
  • Object

rotationVec3Input :Vector3Input

Type:
  • Vector3Input

scaleVec3Input :Vector3Input

Type:
  • Vector3Input

transformCtrls :TransformControls

Type:
  • TransformControls

view :PlanarView

Type:
  • PlanarView

Methods

createBoxSelector() → {Mesh}

Creates a box selector mesh to be used for selecting tiles.

Returns:

The box selector mesh.

Type: 
Mesh

createCoordinatesDomEl() → {HTMLDivElement}

Creates the DOMElement related to the coordinates.

Returns:

DOM element that contains a set of input fields for position, rotation, and scale, as well as a button for selecting an area.

Type: 
HTMLDivElement

createLegoPrevisualisation() → {Mesh}

Creates a Lego previsualization mesh to be used for visualizing the selected area.

Returns:

The Lego previsualization mesh.

Type: 
Mesh

createScaleDomEl() → {HTMLDivElement}

Creates the DOMElement related to the scale.

Returns:

DOM element of Scale Section. Children:

  • ratio: This input number controls the accuracy of the heightmap.
  • countLego: This vec2Input parameter specifies the number of plates to be used in the mockup.
Type: 
HTMLDivElement

generateMockup()

Generates a mockup of the selected area using the specified number of Lego plates.

initDomElement() → {HTMLDivElement}

Creates, set domElement and returns a DOM element.

Returns:

legonizerDomElement the newly <div> element.

Type: 
HTMLDivElement

initScene()

Init the scene by creating a box selector, a Lego previsualization, and adding transform controls to the scene.

selectArea()

Toggle the selection area for a Lego model. When is enabled, you can drag the mouse to define a rectangular area in the 3D view.