WanaPlan

API Docs for: 2.7.0
Show:

RoomComponent3D

Extends BaseComponent3D
Module: Component
Parent Module: Wanaplan

Summary

This component handles rooms in the 3D context.

Constructor

RoomComponent3D

Syntax

RoomComponent3D

(
  • core
)

Summary

Parameters:

  • core Core

    The main engine.

Methods

build

Syntax

build

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

Summary

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

Syntax

carveHole

(
  • room3D
  • hole
  • height
)
BABYLON.Mesh

Summary

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

Inherited from BaseComponent3D:

Syntax

compute

() private

Summary

Recompute of the component.

createInstances

Syntax

createInstances

(
  • roomMesh
)
private

Summary

Creates the object instances and bounding boxes from merged subMeshes.

Parameters:

  • roomMesh BABYLON.Mesh

    3D room mesh.

createRoom

Syntax

createRoom

(
  • room
  • height
)

Summary

Builds a single 3D room with its hoppers.

Parameters:

destroy

Inherited from BaseComponent3D:

Syntax

destroy

()

Summary

Destructor.

disable

Inherited from BaseComponent3D:

Syntax

disable

()

Summary

Disables the component

enable

Inherited from BaseComponent3D:

Syntax

enable

()

Summary

Enables the component

getCeilingMaterial

Syntax

getCeilingMaterial

() BABYLON.Material

Summary

Returns the common ceiling material.

Returns:

BABYLON.Material:

The ceiling Material.

getFloor

Inherited from BaseComponent3D:

Syntax

getFloor

(
  • [structure]
)
BABYLON.Mesh

Summary

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

Parameters:

Returns:

BABYLON.Mesh:

The floor mesh in 3D.

getSideMaterial

Syntax

getSideMaterial

() BABYLON.Material

Summary

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:

Syntax

initialize

()

Summary

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

onContextChanged

Inherited from BaseComponent3D:

Syntax

onContextChanged

(
  • context
)

Summary

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

Parameters:

  • context String

    The new context

onFloorReady

Syntax

onFloorReady

(
  • event
)
private

Summary

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

Parameters:

  • event Event

    The "floor-ready" event.

replaceRoom

Syntax

replaceRoom

(
  • oldRoom
  • newRoom
)
private

Summary

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

Syntax

setCeilingMaterial

(
  • material
)

Summary

Sets the common ceiling material.

Parameters:

  • material BABYLON.Material

    The ceiling Material.

setSideMaterial

Syntax

setSideMaterial

(
  • material
)

Summary

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:

Syntax

startListening

()

Summary

Calls all the event listeners.

stopListening

Inherited from BaseComponent3D:

Syntax

stopListening

()

Summary

Removes all the event listeners.

update

Inherited from BaseComponent3D:

Syntax

update

(
  • deltaTime
)

Summary

Updates the dynamic part of the component.

Parameters:

  • deltaTime Number
    The time interval.

Properties

_defaultMaterial

Syntax

_defaultMaterial

BABYLON.Material private

Summary

Default Material for the floor

_defaultMaterial

Syntax

_defaultMaterial

BABYLON.Material private

Summary

Default Material for the ceiling

_defaultMaterial

Syntax

_defaultMaterial

BABYLON.Material private

Summary

Default Material for carving floors & ceilings

_defaultRoomTextures

Syntax

_defaultRoomTextures

Object private

Summary

Default textures

_materialOffset

Syntax

_materialOffset

Number private

Summary

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

keyboardManager

Inherited from BaseComponent3D:

Syntax

keyboardManager

wnp.KeyboardManager

Summary

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

name

Inherited from BaseComponent3D:

Syntax

name

String

Summary

Name of the component.

structure

Inherited from BaseComponent3D:

Syntax

structure

wnp.Structure

Summary

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

Events

wnp.engine3D.roomsReady

Syntax

wnp.engine3D.roomsReady

Summary

Fired when rooms are ready.