RoomComponent3D Class
This component handles rooms in the 3D context.
Constructor
RoomComponent3D
-
core
Parameters:
-
core
CoreThe main engine.
Item Index
Methods
Properties
Events
Methods
build
-
rooms
-
hoppers
-
floor
-
upHoppers
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
-
room3D
-
hole
-
height
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
()
private
createInstances
-
roomMesh
Creates the object instances and bounding boxes from merged subMeshes.
Parameters:
-
roomMesh
BABYLON.Mesh3D room mesh.
createRoom
-
room
-
height
Builds a single 3D room with its hoppers.
Parameters:
-
room
RoomStructureThe room to build.
-
height
NumberThe height of the room.
destroy
()
disable
()
enable
()
getCeilingMaterial
()
BABYLON.Material
Returns the common ceiling material.
Returns:
The ceiling Material.
getFloor
-
[structure]
Parameters:
-
[structure]
FloorStructure optionalThe floor structure.
Returns:
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:
The side Material.
initialize
()
onContextChanged
-
context
Parameters:
-
context
StringThe new context
onFloorReady
-
event
Callback called when the floor mesh is ready.
Triggered on event wnp.engine3D.floorReady
Parameters:
-
event
EventThe "floor-ready" event.
replaceRoom
-
oldRoom
-
newRoom
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
-
material
Sets the common ceiling material.
Parameters:
-
material
BABYLON.MaterialThe ceiling Material.
setSideMaterial
-
material
Sets the common material displayed on the side of the floor when it is carved by hoppers.
Parameters:
-
material
BABYLON.MaterialThe side Material.
startListening
()
stopListening
()
update
-
deltaTime
Parameters:
-
deltaTime
NumberThe 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
keyboardManager
wnp.KeyboardManager
structure
wnp.Structure
Events
wnp.engine3D.roomsReady
Fired when rooms are ready.