RoomComponent3D
Summary
This component handles rooms in the 3D context.
Constructor
RoomComponent3D
Syntax
RoomComponent3D
-
core
Summary
Parameters:
-
coreCoreThe 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:
-
roomsRoomStructure[]The rooms to build.
-
hoppersHopperStructure[]Polygonal holes in the floor.
-
floorFloorStructureRelated floor.
-
upHoppersHopperStructure[]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:
-
room3DBABYLON.MeshFloor-wide mesh of the rooms.
-
holeBABYLON.Vector2Polygonal 2D hole (flat).
-
heightNumberThe 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:
-
roomMeshBABYLON.Mesh3D room mesh.
createRoom
Syntax
createRoom
-
room -
height
Summary
Builds a single 3D room with its hoppers.
Parameters:
-
roomRoomStructureThe room to build.
-
heightNumberThe 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:
-
contextStringThe new context
onFloorReady
Syntax
onFloorReady
-
event
Summary
Callback called when the floor mesh is ready.
Triggered on event wnp.engine3D.floorReady
Parameters:
-
eventEventThe "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:
-
oldRoomBABYLON.MeshOld room.
-
newRoomBABYLON.MeshNew room.
setCeilingMaterial
Syntax
setCeilingMaterial
-
material
Summary
Sets the common ceiling material.
Parameters:
-
materialBABYLON.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:
-
materialBABYLON.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:
-
deltaTimeNumberThe 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.