DGM_LoadComponent
Summary
A component used to load a stored plan in IndexedDB by its uuid.
Constructor
DGM_LoadComponent
Syntax
DGM_LoadComponent
-
core
Summary
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
Syntax
_carveBeachMesh
-
swimmingPoolCSG
-
floor
Summary
Carves the beauch mesh.
Parameters:
-
swimmingPoolCSG
BABYLON.CSGThe CSG object of all swimming pools.
-
floor
BABYLON.MeshThe current floor.
_createBeach
Syntax
_createBeach
-
size
-
scene
-
[disposeTerrain]
Summary
Creates the beach mesh and setup the water material with it.
_createProperty
Syntax
_createProperty
-
name
-
[getFunc]
-
[setFunc]
Summary
Creates a property for this component.
_generateBeachMesh
Syntax
_generateBeachMesh
-
name
-
tesselation1
-
tesselation2
-
sizeMap
-
sizeBeach
-
scene
Summary
Generates the beach mesh without material.
_getModelIndexByName
Syntax
Summary
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
Syntax
_getSandMaterial
-
[index]
Summary
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
Syntax
_onAddSceneObject
-
event
Summary
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.
Parameters:
-
event
Event | ObjectThe event or an object that contains informations about repopulation.
_onDragEnd
Syntax
_onDragEnd
-
pickedInfo
Summary
Updates the transform of the selected object after a drag.
Parameters:
-
pickedInfo
ObjectAn object which contains data about the dragged mesh.
_onFirstStart
Syntax
_onFirstStart
-
eventOrFunction
Summary
Loads and creates the UI. This method can be executed only one time.
Parameters:
-
eventOrFunction
Event | FunctionAn event or a callback function called when the process is done.
_onGrid3DRebuilt
Syntax
_onGrid3DRebuilt
-
event
Summary
Sets the grid when it is changed.
Parameters:
-
event
EventThe event.
_onKeyUp
Syntax
_onKeyUp
-
event
Summary
Removes an object when the user type the delete key.
Parameters:
-
event
EventThe event.
_onModelDeselected
Syntax
_onModelDeselected
-
event
Summary
Deselect the current mesh if it has the correct tag.
Parameters:
-
event
EventThe event.
_onModelLoaded
Syntax
_onModelLoaded
-
mesh
-
options
Summary
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
Syntax
_onModelSelected
-
event
Summary
Select the current mesh if it has the correct tag.
Parameters:
-
event
EventThe event.
_onSettingsChanged
Syntax
_onSettingsChanged
-
event
Summary
Event handlers used to change settings.
Parameters:
-
event
EventThe event.
_removeObject
Syntax
_removeObject
-
event
Summary
Removes an object from the scene.
Parameters:
-
event
EventThe event.
_repeatTexture
Syntax
_repeatTexture
-
texture
-
factor
Summary
Repeats the texture by the given value.
Parameters:
-
texture
BABYLON.TextureThe texture to use.
-
factor
NumberThe repeat value.
_setupTerrain
Syntax
_setupTerrain
()
private
Summary
Creates or modify the terrain.
_toggleWindow
Syntax
_toggleWindow
()
private
Summary
Toggles the window that displays models and textures.
clearFloorModels
Syntax
clearFloorModels
-
event
Summary
Removes all models from the current scene and save the current configuration.
Parameters:
-
event
EventThe event.
clearUserSettings
Syntax
clearUserSettings
()
Summary
Clear the user's configuration and reset parameters to the default values
destroy
Syntax
destroy
()
Summary
Method called when the component is destroyeddisable
Syntax
disable
()
Summary
Disables the componentenable
Syntax
enable
()
Summary
Enables the componentgetTargeted
Syntax
Summary
Finds out if the given position is over an element handled by the componentParameters:
-
vector
VectorA position, usually the cursor's one.
Returns:
The targeted element, or null if nothing is found.
initialize
Syntax
initialize
()
Summary
Initialize the component by trying to load a plan by its uuid.
initialize
Syntax
initialize
()
Summary
Initialize the component.
initializeComponent
Syntax
initializeComponent
()
private
Summary
Load and create materials and models data.
initializeEvents
Syntax
initializeEvents
()
private
Summary
Initialize events.
loadUserSettings
Syntax
loadUserSettings
-
[repopulate]
Summary
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
Syntax
onContextChanged
-
context
Summary
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
Syntax
onUserConnected
-
event
Summary
Called when the user is connected with the UserIntegrationComponent.
Parameters:
-
event
EventThe event.
repopulate
Syntax
repopulate
()
Summary
Called to repopulate the scene with user's configuration. The scene must be clean before calling this method.
saveUserSettings
Syntax
saveUserSettings
()
Summary
Saves the user's configuration.
setDefaultSkybox
Syntax
setDefaultSkybox
-
[useDefault]
Summary
Sets the default skybox.
Parameters:
-
[useDefault]
Boolean optionalSets to
true
to force use the default sky orfalse
to use the default summer sky.
setTerrainActive
Syntax
setTerrainActive
-
isActive
Summary
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
Syntax
startListening
()
Summary
Calls all the event listeners.stopListening
Syntax
stopListening
()
Summary
Removes all the event listeners.tryLoadPlan
Syntax
tryLoadPlan
-
event
Summary
Try to load a plan by its uuid. The component is destroyed
Parameters:
-
event
EventThe event.