API Docs for: 2.7.3
Show:

RoomComponent3D Class

Extends BaseComponent3D
Module: Component
Parent Module: Wanaplan

This component handles rooms in the 3D context.

Constructor

RoomComponent3D

(
  • core
)

Parameters:

  • core Core

    The main engine.

Methods

build

(
  • rooms
  • hoppers
  • floor
  • upHoppers
)
BABYLON.Mesh

Builds the 3D floor-wide room mesh and adds it to the scene.

Parameters:

Returns:

BABYLON.Mesh:

Floor-wide mesh for the rooms & ceilings.

carveHole

(
  • room3D
  • hole
  • height
)
BABYLON.Mesh

Carves a hole in the room.

Parameters:

  • room3D BABYLON.Mesh

    Floor-wide mesh of the rooms.

  • hole BABYLON.Vector2

    Polygonal 2D hole (flat).

  • height Number

    The height of the hole, amount of the 3D extrusion of the 2D polygon.

Returns:

BABYLON.Mesh:

finalRoom Room after carving.

compute

() private

Inherited from BaseComponent3D:

Recompute of the component.

createInstances

(
  • roomMesh
)
private

Creates the object instances and bounding boxes from merged subMeshes.

Parameters:

  • roomMesh BABYLON.Mesh

    3D room mesh.

createRoom

(
  • room
  • height
)

Builds a single 3D room with its hoppers.

Parameters:

destroy

()

Inherited from BaseComponent3D:

Destructor.

disable

()

Inherited from BaseComponent3D:

Disables the component

enable

()

Inherited from BaseComponent3D:

Enables the component

getCeilingMaterial

() BABYLON.Material

Returns the common ceiling material.

Returns:

BABYLON.Material:

The ceiling Material.

getFloor

(
  • [structure]
)
BABYLON.Mesh

Inherited from BaseComponent3D:

Gets the 3D mesh of the floor structure in parameter (by default current floor).

Parameters:

Returns:

BABYLON.Mesh:

The floor mesh in 3D.

getSideMaterial

() BABYLON.Material

Returns the common material displayed on the side of the floor when it is carved by hoppers.

Returns:

BABYLON.Material:

The side Material.

initialize

()

Inherited from BaseComponent3D:

Method called when Wanaplan is initialized. You don't need to call this method manually.

onContextChanged

(
  • context
)

Inherited from BaseComponent3D:

Method called when the context is switched (2D -> 3D or 3D -> 2D)

Parameters:

  • context String

    The new context

onFloorReady

(
  • event
)
private

Callback called when the floor mesh is ready. Triggered on event wnp.engine3D.floorReady

Parameters:

  • event Event

    The "floor-ready" event.

replaceRoom

(
  • oldRoom
  • newRoom
)
private

Replaces the former 3D room mesh with a new 3D mesh, keeping the custom properties of the 3D room mesh like "boundingBoxes" or "objectInstances".

Parameters:

  • oldRoom BABYLON.Mesh

    Old room.

  • newRoom BABYLON.Mesh

    New room.

setCeilingMaterial

(
  • material
)

Sets the common ceiling material.

Parameters:

  • material BABYLON.Material

    The ceiling Material.

setSideMaterial

(
  • material
)

Sets the common material displayed on the side of the floor when it is carved by hoppers.

Parameters:

  • material BABYLON.Material

    The side Material.

startListening

()

Inherited from BaseComponent3D:

Calls all the event listeners.

stopListening

()

Inherited from BaseComponent3D:

Removes all the event listeners.

update

(
  • deltaTime
)

Inherited from BaseComponent3D:

Updates the dynamic part of the component.

Parameters:

  • deltaTime Number
    The time interval.

Properties

_defaultMaterial

BABYLON.Material private

Default Material for the floor

_defaultMaterial

BABYLON.Material private

Default Material for the ceiling

_defaultMaterial

BABYLON.Material private

Default Material for carving floors & ceilings

_defaultRoomTextures

Object private

Default textures

_materialOffset

Number private

Material offset for batching of the rooms into 1 single mesh.

keyboardManager

wnp.KeyboardManager

Inherited from BaseComponent3D:

Instance of the Keyboard Manager (shortcut to wanaplan.keyboardManager).

name

String

Inherited from BaseComponent3D:

Name of the component.

structure

wnp.Structure

Inherited from BaseComponent3D:

Instance of the structure (shortcut to wanaplan.structure).

Events

wnp.engine3D.roomsReady

Fired when rooms are ready.