API Docs for: 2.7.3
Show:

DGM_LoadComponent Class

Extends BaseComponent2D
Module: Wanaplan

A component used to load a stored plan in IndexedDB by its uuid.

Constructor

DGM_LoadComponent

(
  • core
)

Parameters:

  • core Core

    The main engine.

Methods

_carveBeachMesh

(
  • swimmingPoolCSG
  • floor
)
private

Carves the beauch mesh.

Parameters:

  • swimmingPoolCSG BABYLON.CSG

    The CSG object of all swimming pools.

  • floor BABYLON.Mesh

    The current floor.

_createBeach

(
  • size
  • scene
  • [disposeTerrain]
)
private

Creates the beach mesh and setup the water material with it.

Parameters:

  • size Number

    The size of the mesh

  • scene BABYLON.Scene

    The scene

  • [disposeTerrain] Boolean optional

    Sets to true to dispose the terrain.

_createProperty

(
  • name
  • [getFunc]
  • [setFunc]
)
private

Creates a property for this component.

Parameters:

  • name String

    The name of the property.

  • [getFunc] Function optional

    The getter function.

  • [setFunc] Function optional

    The setter function.

_generateBeachMesh

(
  • name
  • tesselation1
  • tesselation2
  • sizeMap
  • sizeBeach
  • scene
)
private

Generates the beach mesh without material.

Parameters:

  • name String

    The name of the mesh.

  • tesselation1 Number

    The first value of tesselation

  • tesselation2 Number

    The second value of tesselation

  • sizeMap Number

    The size of the map.

  • sizeBeach Number

    The size of the beach.

  • scene BABYLON.Scene

    The main scene.

_getModelIndexByName

(
  • name
)
Number private

Gets the index of a model by its name.

Parameters:

  • name String

    The name of the model.

Returns:

Number:

Returns the index of the model if it exists, otherwise it returns -1.

_getSandMaterial

(
  • [index]
)
BABYLON.Material private

Gets the current sand material

Parameters:

  • [index] Number optional

    Sets the material index (default is this._userScene.terrain.material).

Returns:

BABYLON.Material:

Returns the current sand material.

_onAddSceneObject

(
  • event
)
private

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 | Object

    The event or an object that contains informations about repopulation.

_onDragEnd

(
  • pickedInfo
)
private

Updates the transform of the selected object after a drag.

Parameters:

  • pickedInfo Object

    An object which contains data about the dragged mesh.

_onFirstStart

(
  • eventOrFunction
)
private

Loads and creates the UI. This method can be executed only one time.

Parameters:

  • eventOrFunction Event | Function

    An event or a callback function called when the process is done.

_onGrid3DRebuilt

(
  • event
)
private

Sets the grid when it is changed.

Parameters:

_onKeyUp

(
  • event
)
private

Removes an object when the user type the delete key.

Parameters:

_onModelDeselected

(
  • event
)
private

Deselect the current mesh if it has the correct tag.

Parameters:

_onModelLoaded

(
  • mesh
  • options
)
private

Creates the correct parenting for the model and update its transform with saved value (if saved).

Parameters:

  • mesh BABYLON.Mesh

    The mesh.

  • options Object

    A set of options.

_onModelSelected

(
  • event
)
private

Select the current mesh if it has the correct tag.

Parameters:

_onSettingsChanged

(
  • event
)
private

Event handlers used to change settings.

Parameters:

_removeObject

(
  • event
)
private

Removes an object from the scene.

Parameters:

_repeatTexture

(
  • texture
  • factor
)
private

Repeats the texture by the given value.

Parameters:

  • texture BABYLON.Texture

    The texture to use.

  • factor Number

    The 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:

clearUserSettings

()

Clear the user's configuration and reset parameters to the default values

destroy

()

Inherited from BaseComponent2D:

Method called when the component is destroyed

disable

()

Inherited from BaseComponent2D:

Disables the component

enable

()

Inherited from BaseComponent2D:

Enables the component

getTargeted

(
  • vector
)
Object

Inherited from BaseComponent2D:

Finds out if the given position is over an element handled by the component

Parameters:

  • vector Vector

    A position, usually the cursor's one.

Returns:

Object:

The targeted element, or null if nothing is found.

initialize

()

Initialize the component by trying to load a plan by its uuid.

initialize

()

Inherited from BaseComponent2D

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 optional

    Set to true to repopulate the scene when data are loaded.

onContextChanged

(
  • context
)

Inherited from BaseComponent2D

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 String

    The current graphics context (2D or 3D).

onUserConnected

(
  • event
)

Called when the user is connected with the UserIntegrationComponent.

Parameters:

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 optional

    Sets to true to force use the default sky or false 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 Boolean

    Set to true to active the beach mesh and disable the grid or false to reverse.

startListening

()

Inherited from BaseComponent2D:

Calls all the event listeners.

stopListening

()

Inherited from BaseComponent2D:

Removes all the event listeners.

tryLoadPlan

(
  • event
)

Try to load a plan by its uuid. The component is destroyed

Parameters:

update

()

Inherited from BaseComponent2D:

Generic update method, called on every frame

Properties

name

String

Inherited from BaseComponent2D:

Component name

priority

Number

Inherited from BaseComponent2D:

Priority of the component in the "update" and "draw" routines

structure

wnp.Structure

Inherited from BaseComponent2D:

Structure file instance (shortcut to wanaplan.structure). This is the base object where the whole plan is saved