WanaPlan

API Docs for: 2.7.0
Show:

wnp.CameraFeatures

Module: Helpers
Parent Module: Wanaplan

Summary

The Camera Features adds cool features for camera management.

Methods

buildPlaneFromBB

Syntax

buildPlaneFromBB

(
  • box
)
BABYLON.Plane

Summary

Builds a plane from a bounding box.

Parameters:

  • box BABYLON.BoundingBox

    A bounding box.

Returns:

BABYLON.Plane:

A plane.

computeAnimation

Syntax

computeAnimation

(
  • target
  • src
  • dst
  • options
)
wnp.AnimationCancelor

Summary

Computes an animation by given an amnimatable object , source state and destination state, compute the animations babylon way and start play it

Parameters:

  • target BABYLON.Mesh

    is the animatable object that will be animate

  • src BABYLON.Vectior3

    is a set of property and their value at the begin of the animation

  • dst Object

    is a set of property and their value at the end of the animation

  • options Object

    Animation options

    • [duration=0] Number optional

      Animation duration in ms.

    • [callback] Function optional

      A function to call at the end of the animation.

    • [cleanAfterAnimation=true] Boolean optional

      If true the animation will be cleaned at the end, if false, the cancel function MUST be called somewhere.

    • [name="Animation"] String optional

      A name.

    • [isACamera=false] Boolean optional

      If set to true, the event camera.move will be triggered during the animation

    • [smooth='linear'] Smoothing interpolation. Accepted values are `"linear"`, `"ease"` or a function f : [0:1] -> [0:1] String | Function optional

Returns:

wnp.AnimationCancelor:

A function that cancels the animation on calling and cleans it up. This function will be called at the end of the animation if cleanAfterAnimation is true.

computeCameraStateLooking

Syntax

computeCameraStateLooking

(
  • target
  • camera
  • [viewport]
)
Object

Summary

Computes the best camera state to focus on an object. Only works with an OrbitCamera.

Parameters:

  • target BABYLON.Mesh

    The mesh to focus on.

  • camera BABYLON.Camera

    The camera involved.

  • [viewport] BABYLON.Viewport optional

    The viewport to use, default is (0, 0, 1, 1);

Returns:

Object:

An object where :

  • target is the targetted mesh.
  • alpha is the alpha angle of the camera (see OrbitCamera doc).
  • beta is the beta angle of the camera (see OrbitCamera doc).
  • radius is the radius of the camera (see OrbitCamera doc).

dynamicWallTransparency

Syntax

dynamicWallTransparency

()

Summary

Applies transparency to wall materials based on the position and target of the camera. Used to see through walls and roofs.

fillByZIndex

Syntax

fillByZIndex

(
  • wallMesh
)
Array

Summary

This function is related to the wall transparency.
Builds an index array corresponding to the submesh indexes in the wall mesh.
These submeshes must be transparent to have a clear display of the camera target.
This is only relevant if the wall transparency option is active.

Parameters:

  • wallMesh BABYLON.Mesh

    The wall mesh.

Returns:

Array:

The submesh index array.

getBestFocusRadius

Syntax

getBestFocusRadius

(
  • target
  • camera
  • scene
)
Number

Summary

Gets the best focus radius for the camera to be in the best setup, in order to see the whole mesh.
N.B : The current position and target of the camera is irrelevant, this function will work anyway.

Parameters:

  • target BABYLON.Mesh

    The mesh to focus on.

  • camera BABYLON.Camera

    The camera involved.

  • scene BABYLON.Scene

    The scene.

Returns:

Number:

radius Returns the radius to use.

makeWallsOpaque

Syntax

makeWallsOpaque

(
  • [floor]
)

Summary

Sets all walls to opaque for a given floor.

Parameters:

  • [floor] FloorStructure optional

    A floor to make opaque. Default is the current selected floor.

onCameraMove

Syntax

onCameraMove

(
  • event
)
private

Summary

Tests for wall transparency. Triggered on wnp.engine3D.camera.move.

Parameters:

  • event Event

    An event object.

onCameraZoom

Syntax

onCameraZoom

(
  • event
)
private

Summary

Tests for wall transparency. Triggered on wnp.engine3D.camera.zoom.

Parameters:

  • event Event

    An event object.

onContextChanged

Syntax

onContextChanged

(
  • event
)
private

Summary

Sets all walls to opaque when the 3D mode is enabled. Triggered on wnp.contextChanged

Parameters:

  • event Event

    An event object.

onGlobaleFloorReady

Syntax

onGlobaleFloorReady

(
  • event
)
private

Summary

Handler which will apply transparency only on walls at the current floor. Triggered on wnp.engine3D.allFloorsReady

Parameters:

  • event Event

    An event object.

onWallsReady

Syntax

onWallsReady

(
  • event
)
private

Summary

Handler called when the whole walls are ready (with their subslopes). Triggered on wnp.engine3D.subslopeOverturesReady.

Parameters:

  • event Event

    An event object.

setCamera

Syntax

setCamera

(
  • camera
)

Summary

Sets the current camera for this class.

Parameters:

  • camera BABYLON.Camera

    The camera to use.

startTransparency

Syntax

startTransparency

()

Summary

Starts the transparency when the user clicks on the transparency button.

stopTransparency

Syntax

stopTransparency

()

Summary

Stops the wall transparency when the user clicks on the transparency button.

Events

wnp.engine3D.camera.move

Syntax

wnp.engine3D.camera.move

Summary

Fired when the 3D camera has moved.