RoomComponent3D
Summary
This component handles rooms in the 3D context.
Constructor
RoomComponent3D
Syntax
RoomComponent3D
-
core
Summary
Parameters:
-
core
CoreThe main engine.
Item Index
Methods
Properties
Events
Methods
build
Syntax
build
-
rooms
-
hoppers
-
floor
-
upHoppers
Summary
Builds the 3D floor-wide room mesh and adds it to the scene.
Parameters:
-
rooms
RoomStructure[]The rooms to build.
-
hoppers
HopperStructure[]Polygonal holes in the floor.
-
floor
FloorStructureRelated floor.
-
upHoppers
HopperStructure[]Polygonal holes in the ceiling.
Returns:
Floor-wide mesh for the rooms & ceilings.
carveHole
Syntax
carveHole
-
room3D
-
hole
-
height
Summary
Carves a hole in the room.
Parameters:
-
room3D
BABYLON.MeshFloor-wide mesh of the rooms.
-
hole
BABYLON.Vector2Polygonal 2D hole (flat).
-
height
NumberThe height of the hole, amount of the 3D extrusion of the 2D polygon.
Returns:
finalRoom Room after carving.
compute
Syntax
compute
()
private
Summary
Recompute of the component.createInstances
Syntax
createInstances
-
roomMesh
Summary
Creates the object instances and bounding boxes from merged subMeshes.
Parameters:
-
roomMesh
BABYLON.Mesh3D room mesh.
createRoom
Syntax
createRoom
-
room
-
height
Summary
Builds a single 3D room with its hoppers.
Parameters:
-
room
RoomStructureThe room to build.
-
height
NumberThe height of the room.
destroy
Syntax
destroy
()
Summary
Destructor.disable
Syntax
disable
()
Summary
Disables the componentenable
Syntax
enable
()
Summary
Enables the componentgetCeilingMaterial
Syntax
getCeilingMaterial
()
BABYLON.Material
Summary
Returns the common ceiling material.
Returns:
The ceiling Material.
getFloor
Syntax
getFloor
-
[structure]
Summary
Gets the 3D mesh of the floor structure in parameter (by default current floor).Parameters:
-
[structure]
FloorStructure optionalThe floor structure.
Returns:
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:
The side Material.
initialize
Syntax
initialize
()
Summary
Method called when Wanaplan is initialized. You don't need to call this method manually.onContextChanged
Syntax
onContextChanged
-
context
Summary
Method called when the context is switched (2D -> 3D or 3D -> 2D)Parameters:
-
context
StringThe new context
onFloorReady
Syntax
onFloorReady
-
event
Summary
Callback called when the floor mesh is ready.
Triggered on event wnp.engine3D.floorReady
Parameters:
-
event
EventThe "floor-ready" event.
replaceRoom
Syntax
replaceRoom
-
oldRoom
-
newRoom
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.MeshOld room.
-
newRoom
BABYLON.MeshNew room.
setCeilingMaterial
Syntax
setCeilingMaterial
-
material
Summary
Sets the common ceiling material.
Parameters:
-
material
BABYLON.MaterialThe 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.MaterialThe side Material.
startListening
Syntax
startListening
()
Summary
Calls all the event listeners.stopListening
Syntax
stopListening
()
Summary
Removes all the event listeners.update
Syntax
update
-
deltaTime
Summary
Updates the dynamic part of the component.Parameters:
-
deltaTime
NumberThe 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
_materialOffset
Syntax
Summary
Material offset for batching of the rooms into 1 single mesh.
keyboardManager
Syntax
keyboardManager
wnp.KeyboardManager
Summary
Instance of the Keyboard Manager (shortcut to wanaplan.keyboardManager).structure
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.