API Docs for: 1.0.2
Show:

GIScene.Scene Class

Extends THREE.EventDispatcher
Defined in: GIScene\Scene.js:1
Module: GIScene

The Scene Object

Constructor

GIScene.Scene

(
  • containerDivId
  • [config]
)

Defined in GIScene\Scene.js:1

Parameters:

  • containerDivId String

    The id of an HTMLDivElement which will be used as container for the webgl canvas.

  • [config] Object optional

    Allowed values for config are:

    cameratype: 'perspective'|'ortho'
    

    near: {Number} far: {Numver} fov: {Number}

    width: {Integer} height: {Integer}

    animate:{Boolean}

    center: {THREE.Vector3} positionFromCenter: {THREE.Vector3} projection: {String} units: {String} offset: {GIScene.Coordinate3} skyColor: {THREE.Color} fog: {THREE.Fog}

Methods

addControl

()

Adds a control to the scene

addEventListener

(
  • eventType
  • listener
)

inherited from THREE.EventDispatcher

Parameters:

  • eventType String
  • listener Function

    function, to be called when the event is dispatched

addLayer

()

Adds a layer to the scene

dispatchEvent

(
  • event
)

inherited from THREE.EventDispatcher

Parameters:

  • event Object

Example:

this.dispatchEvent( { type: 'beforeRender', content: anythingToBePassedToTheListeners } );

disposeLayer

(
  • layer
)

Deletes all layer objects and the layer from memory

Parameters:

getLayerById

(
  • id
)
GIScene.Layer

Parameters:

  • id String

Returns:

GIScene.Layer:

result returns the layer found by id or null

getLayerDescendants

(
  • filter
)

get all descendants of the layers. Optionally the layers can be filtered by an array filter function.

Parameters:

  • filter Function

    An array filter function that is applied to each layer object of the scene. Should return true or false.

Example:

//get only descendants of layers that are not Helper Layers
scene.getLayerDescendants(function(e,i,a){
    return !(e instanceof GIScene.Layer.Helper);
    }
);

getObjectsBy

(
  • callback
)
Array

get Objects by a evaluation function which recursively tries to match the objects of the scene

Parameters:

  • callback Function

Returns:

Array:

matches

hasEventListener

(
  • eventType
  • listener
)

inherited from THREE.EventDispatcher

Parameters:

  • eventType String
  • listener Function

    function, to be removed from the event

removeControl

()

Removes a control from the scene

removeEventListener

(
  • eventType
  • listener
)

inherited from THREE.EventDispatcher

Parameters:

  • eventType String
  • listener Function

    function, to be removed from the event

removeLayer

()

Removes a layer from the scene

setCenter

(
  • vector
  • positionFromCenter
  • duration
)

Jump to another place in the scene.

Parameters:

  • vector THREE.Vector3

    vector in scene coordinates

  • positionFromCenter THREE.Vector3

    vector to place the camera at some distance from the point of interest (vector)

  • duration Number

    duration in milliseconds. if undefined or > 0 an animation is perforemed from the current to the specified new center. Set this to 0 to jump immediately to the new location.

setFaceCulling

(
  • faceCullingMode
)

Sets the face culling mode for the whole scene

Parameters:

  • faceCullingMode THREE.FrontSide | | THREE.BackSide | | THREE.DoubleSide | | 'default'

setShading

(
  • shadingMode
)

Sets the shading mode for the whole scene

Parameters:

  • shadingMode THREE.FlatShading | | THREE.SmoothShading | | 'default'

setTexturing

(
  • texturingMode
)

Sets texturing of on or off for the whole scene

Parameters:

  • texturingMode Mixed

    can be: {String} 'default' | {boolean} true | {boolean} false

setVertexColors

(
  • vertexColorMode
)

Sets the vertex color mode for the whole scene

Parameters:

  • vertexColorMode THREE.NoColors | | THREE.FaceColors | | THREE.VertexColors | | 'default'

setWireframe

(
  • wireframeMode
)

Set the wireframe property for the whole scene

Parameters:

  • wireframeMode Mixed

    can be {String} 'default' | {boolean} true | {boolean} false

startAnimation

()

Start animation frame and render loop

stopAnimation

()

Stop animation frame and render loop

viewFrom

(
  • relativePosition
)

Function to move camera to predefined relative positions from Scene.center

Parameters:

  • relativePosition String

    allowed values are 'left','right','front','back','top','bottom'

Properties

camera

THREE.CombinedCamera

The active camera. {THREE.CombinedCamera} can be switched from perspective to orthographic and vice versa

config

Object

Defined in GIScene\Scene.js:72

The config which is used to initialize the Scene. Merged from defaults and passed config Object.

defaults

Object private

Defined in GIScene\Scene.js:33

The default config which is used when no config object is provided.

root

THREE.Scene

Defined in GIScene\Scene.js:98

The scenegraph root node. Add {THREE.Object3D}-objects to this node. See THREE.js docs for further information

Events

addlayer

beforeRender

beforeRender Event will be executed directly before the render call in the render loop

beforeRender

beforeRender2 Event will be executed directly before the render call in the render loop

cameraChange

Fires whenever camera position changes

center

Fires after setCenter() completed

center

Fires after setCenter() completed

removelayer

removelayer