Skip to main content

Floor

Floor is arguably the most important object (Object3DWrapper) in 3d-tour-next. It is responsible for creating various objects such as a Cube (panorama), a Dollhouse, FloorHotspots, MeasuringObjects etc.

note

Object3DWrapper

Object3DWrapper is exactly how it sounds like. It is an abstract class that forces the implementation of public abstract object3D property to every class that extends it.

By avoiding direct inheritance of THREE.Object3D and its derivatives (things like THREE.Mesh), classes extending Object3DWrapper are free to choose any property or method names without worrying about conflicting with the names of THREE.Object3D 's own properties and methods (things like id, parent, etc).

Conveniently, Object3DWrapper knows how to add another Object3DWrapper as well as a raw THREE.Object3D as its child.

constructor()

While being instantiated, the Floor first creates a DomElementManager with World3D.container as a parent. This dom element will be used as the root node for any measurement-related labels (rendered as HTMLElements, not Object3Ds) created in the measurement mode.

And then it goes on to create a Dollhouse instance (if user provided dollhouse-related data), a Measurement instance, and a FloorHotspotManager instance.