WanaPlan

API Docs for: 2.7.0
Show:

DGM_LoadComponent

Extends BaseComponent2D
Module: Wanaplan

Summary

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

Constructor

DGM_LoadComponent

Syntax

DGM_LoadComponent

(
  • core
)

Summary

Parameters:

  • core Core

    The main engine.

Methods

_carveBeachMesh

Syntax

_carveBeachMesh

(
  • swimmingPoolCSG
  • floor
)
private

Summary

Carves the beauch mesh.

Parameters:

  • swimmingPoolCSG BABYLON.CSG

    The CSG object of all swimming pools.

  • floor BABYLON.Mesh

    The current floor.

_createBeach

Syntax

_createBeach

(
  • size
  • scene
  • [disposeTerrain]
)
private

Summary

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

Syntax

_createProperty

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

Summary

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

Syntax

_generateBeachMesh

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

Summary

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

Syntax

_getModelIndexByName

(
  • name
)
Number private

Summary

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

Syntax

_getSandMaterial

(
  • [index]
)
BABYLON.Material private

Summary

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

Syntax

_onAddSceneObject

(
  • event
)
private

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

    The event or an object that contains informations about repopulation.

_onDragEnd

Syntax

_onDragEnd

(
  • pickedInfo
)
private

Summary

Updates the transform of the selected object after a drag.

Parameters:

  • pickedInfo Object

    An object which contains data about the dragged mesh.

_onFirstStart

Syntax

_onFirstStart

(
  • eventOrFunction
)
private

Summary

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

Syntax

_onGrid3DRebuilt

(
  • event
)
private

Summary

Sets the grid when it is changed.

Parameters:

  • event Event

    The event.

_onKeyUp

Syntax

_onKeyUp

(
  • event
)
private

Summary

Removes an object when the user type the delete key.

Parameters:

  • event Event

    The event.

_onModelDeselected

Syntax

_onModelDeselected

(
  • event
)
private

Summary

Deselect the current mesh if it has the correct tag.

Parameters:

  • event Event

    The event.

_onModelLoaded

Syntax

_onModelLoaded

(
  • mesh
  • options
)
private

Summary

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

Syntax

_onModelSelected

(
  • event
)
private

Summary

Select the current mesh if it has the correct tag.

Parameters:

  • event Event

    The event.

_onSettingsChanged

Syntax

_onSettingsChanged

(
  • event
)
private

Summary

Event handlers used to change settings.

Parameters:

  • event Event

    The event.

_removeObject

Syntax

_removeObject

(
  • event
)
private

Summary

Removes an object from the scene.

Parameters:

  • event Event

    The event.

_repeatTexture

Syntax

_repeatTexture

(
  • texture
  • factor
)
private

Summary

Repeats the texture by the given value.

Parameters:

  • texture BABYLON.Texture

    The texture to use.

  • factor Number

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

    The event.

clearUserSettings

Syntax

clearUserSettings

()

Summary

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

destroy

Inherited from BaseComponent2D:

Syntax

destroy

()

Summary

Method called when the component is destroyed

disable

Inherited from BaseComponent2D:

Syntax

disable

()

Summary

Disables the component

enable

Inherited from BaseComponent2D:

Syntax

enable

()

Summary

Enables the component

getTargeted

Inherited from BaseComponent2D:

Syntax

getTargeted

(
  • vector
)
Object

Summary

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

Syntax

initialize

()

Summary

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

initialize

Inherited from BaseComponent2D

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 optional

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

onContextChanged

Inherited from BaseComponent2D

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 String

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

onUserConnected

Syntax

onUserConnected

(
  • event
)

Summary

Called when the user is connected with the UserIntegrationComponent.

Parameters:

  • event Event

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

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

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

startListening

Inherited from BaseComponent2D:

Syntax

startListening

()

Summary

Calls all the event listeners.

stopListening

Inherited from BaseComponent2D:

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 Event

    The event.

update

Inherited from BaseComponent2D:

Syntax

update

()

Summary

Generic update method, called on every frame

Properties

name

Inherited from BaseComponent2D:

Syntax

name

String

Summary

Component name

priority

Inherited from BaseComponent2D:

Syntax

priority

Number

Summary

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

structure

Inherited from BaseComponent2D:

Syntax

structure

wnp.Structure

Summary

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