GIScene.Scene Class
The Scene Object
Constructor
GIScene.Scene
-
containerDivId
-
[config]
Parameters:
-
containerDivId
StringThe id of an HTMLDivElement which will be used as container for the webgl canvas.
-
[config]
Object optionalAllowed 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}
Item Index
Methods
Methods
addControl
()
Adds a control to the scene
addEventListener
-
eventType
-
listener
inherited from THREE.EventDispatcher
Parameters:
-
eventType
String -
listener
Functionfunction, 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:
-
layer
GIScene.Layer
getLayerById
-
id
Parameters:
-
id
String
Returns:
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
FunctionAn 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
get Objects by a evaluation function which recursively tries to match the objects of the scene
Parameters:
-
callback
Function
Returns:
matches
hasEventListener
-
eventType
-
listener
inherited from THREE.EventDispatcher
Parameters:
-
eventType
String -
listener
Functionfunction, to be removed from the event
removeControl
()
Removes a control from the scene
removeEventListener
-
eventType
-
listener
inherited from THREE.EventDispatcher
Parameters:
-
eventType
String -
listener
Functionfunction, 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.Vector3vector in scene coordinates
-
positionFromCenter
THREE.Vector3vector to place the camera at some distance from the point of interest (vector)
-
duration
Numberduration 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
Mixedcan 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
Mixedcan 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
Stringallowed 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
The config which is used to initialize the Scene. Merged from defaults and passed config Object.
defaults
Object
private
The default config which is used when no config object is provided.
root
THREE.Scene
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