DGM_LoadComponent Class
A component used to load a stored plan in IndexedDB by its uuid.
Constructor
DGM_LoadComponent
-
core
Parameters:
-
core
CoreThe main engine.
Item Index
Methods
- _carveBeachMesh
- _createBeach
- _createProperty
- _generateBeachMesh
- _getModelIndexByName
- _getSandMaterial
- _onAddSceneObject
- _onDragEnd
- _onFirstStart
- _onGrid3DRebuilt
- _onKeyUp
- _onModelDeselected
- _onModelLoaded
- _onModelSelected
- _onSettingsChanged
- _removeObject
- _repeatTexture
- _setupTerrain
- _toggleWindow
- clearFloorModels
- clearUserSettings
- destroy
- disable
- enable
- getTargeted
- initialize
- initialize
- initializeComponent
- initializeEvents
- loadUserSettings
- onContextChanged
- onUserConnected
- repopulate
- saveUserSettings
- setDefaultSkybox
- setTerrainActive
- startListening
- stopListening
- tryLoadPlan
- update
Methods
_carveBeachMesh
-
swimmingPoolCSG
-
floor
Carves the beauch mesh.
Parameters:
-
swimmingPoolCSG
BABYLON.CSGThe CSG object of all swimming pools.
-
floor
BABYLON.MeshThe current floor.
_createBeach
-
size
-
scene
-
[disposeTerrain]
Creates the beach mesh and setup the water material with it.
_createProperty
-
name
-
[getFunc]
-
[setFunc]
Creates a property for this component.
_generateBeachMesh
-
name
-
tesselation1
-
tesselation2
-
sizeMap
-
sizeBeach
-
scene
Generates the beach mesh without material.
_getModelIndexByName
-
name
Gets the index of a model by its name.
Parameters:
-
name
StringThe name of the model.
Returns:
Returns the index of the model if it exists, otherwise it returns -1.
_getSandMaterial
-
[index]
Gets the current sand material
Parameters:
-
[index]
Number optionalSets the material index (default is this._userScene.terrain.material).
Returns:
Returns the current sand material.
_onAddSceneObject
-
event
Event handlers responsible to add object to the scene or to change the texture of the beach. It is used to repopulate the scene too.
_onDragEnd
-
pickedInfo
Updates the transform of the selected object after a drag.
Parameters:
-
pickedInfo
ObjectAn object which contains data about the dragged mesh.
_onFirstStart
-
eventOrFunction
Loads and creates the UI. This method can be executed only one time.
_onGrid3DRebuilt
-
event
Sets the grid when it is changed.
Parameters:
-
event
EventThe event.
_onKeyUp
-
event
Removes an object when the user type the delete key.
Parameters:
-
event
EventThe event.
_onModelDeselected
-
event
Deselect the current mesh if it has the correct tag.
Parameters:
-
event
EventThe event.
_onModelLoaded
-
mesh
-
options
Creates the correct parenting for the model and update its transform with saved value (if saved).
Parameters:
-
mesh
BABYLON.MeshThe mesh.
-
options
ObjectA set of options.
_onModelSelected
-
event
Select the current mesh if it has the correct tag.
Parameters:
-
event
EventThe event.
_onSettingsChanged
-
event
Event handlers used to change settings.
Parameters:
-
event
EventThe event.
_removeObject
-
event
Removes an object from the scene.
Parameters:
-
event
EventThe event.
_repeatTexture
-
texture
-
factor
Repeats the texture by the given value.
Parameters:
-
texture
BABYLON.TextureThe texture to use.
-
factor
NumberThe repeat value.
_setupTerrain
()
private
Creates or modify the terrain.
_toggleWindow
()
private
Toggles the window that displays models and textures.
clearFloorModels
-
event
Removes all models from the current scene and save the current configuration.
Parameters:
-
event
EventThe event.
clearUserSettings
()
Clear the user's configuration and reset parameters to the default values
destroy
()
disable
()
enable
()
getTargeted
-
vector
Parameters:
-
vector
VectorA position, usually the cursor's one.
Returns:
The targeted element, or null if nothing is found.
initialize
()
Initialize the component by trying to load a plan by its uuid.
initialize
()
Initialize the component.
initializeComponent
()
private
Load and create materials and models data.
initializeEvents
()
private
Initialize events.
loadUserSettings
-
[repopulate]
Loads the user's configuration. The configuration contains data about models, terrain and parameters.
Parameters:
-
[repopulate]
Boolean optionalSet to
true
to repopulate the scene when data are loaded.
onContextChanged
-
context
Adds the menu icon when the context is 3D
and repopulate it.
When it's a 2D
context, the menu icon is removed.
Parameters:
-
context
StringThe current graphics context (
2D
or3D
).
onUserConnected
-
event
Called when the user is connected with the UserIntegrationComponent.
Parameters:
-
event
EventThe event.
repopulate
()
Called to repopulate the scene with user's configuration. The scene must be clean before calling this method.
saveUserSettings
()
Saves the user's configuration.
setDefaultSkybox
-
[useDefault]
Sets the default skybox.
Parameters:
-
[useDefault]
Boolean optionalSets to
true
to force use the default sky orfalse
to use the default summer sky.
setTerrainActive
-
isActive
Enable or disable the beach mesh. If it's enabled then the grid mesh is disabled.
Parameters:
-
isActive
BooleanSet to
true
to active the beach mesh and disable the grid orfalse
to reverse.
startListening
()
stopListening
()
tryLoadPlan
-
event
Try to load a plan by its uuid. The component is destroyed
Parameters:
-
event
EventThe event.