new Scene(options)
CesiumWidget.
contextOptions parameter details:
The default values are:
{
webgl : {
alpha : false,
depth : true,
stencil : false,
antialias : true,
premultipliedAlpha : true,
preserveDrawingBuffer : false
failIfMajorPerformanceCaveat : true
},
allowTextureFilterAnisotropic : true
}
The webgl property corresponds to the WebGLContextAttributes
object used to create the WebGL context.
webgl.alpha defaults to false, which can improve performance compared to the standard WebGL default
of true. If an application needs to composite Cesium above other HTML elements using alpha-blending, set
webgl.alpha to true.
webgl.failIfMajorPerformanceCaveat defaults to true, which ensures a context is not successfully created
if the system has a major performance issue such as only supporting software rendering. The standard WebGL default is false,
which is not appropriate for almost any Cesium app.
The other webgl properties match the WebGL defaults for WebGLContextAttributes.
allowTextureFilterAnisotropic defaults to true, which enables anisotropic texture filtering when the
WebGL extension is supported. Setting this to false will improve performance, but hurt visual quality, especially for horizon views.
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
optional
Object with the following properties:
|
Throws:
-
DeveloperError : options and options.canvas are required.
Example:
// Create scene without anisotropic texture filtering
var scene = new Cesium.Scene({
canvas : canvas,
contextOptions : {
allowTextureFilterAnisotropic : false
}
});
See:
Members
-
backgroundColor :Color
-
The background color, which is only visible if there is no sky box, i.e.,
Scene#skyBoxis undefined.-
Default Value:
Color.BLACKSee:
Source: Scene/Scene.js, line 316 -
readonlycamera :Camera
-
Gets the camera.Source: Scene/Scene.js, line 553
-
readonlycanvas :Element
-
Gets the canvas element to which this scene is bound.Source: Scene/Scene.js, line 465
-
completeMorphOnUserInput :Boolean
-
Determines whether or not to instantly complete the scene transition animation on user input.
-
Default Value:
trueSource: Scene/Scene.js, line 249 -
debugCommandFilter :function
-
This property is for debugging only; it is not for production use.
A function that determines what commands are executed. As shown in the examples below, the function receives the command's
owneras an argument, and returns a boolean indicating if the command should be executed.The default is
undefined, indicating that all commands are executed.-
Default Value:
- DrawCommand
- ClearCommand
undefinedExample:
// Do not execute any commands. scene.debugCommandFilter = function(command) { return false; }; // Execute only the billboard's commands. That is, only draw the billboard. var billboards = new Cesium.BillboardCollection(); scene.debugCommandFilter = function(command) { return command.owner === billboards; };See:
Source: Scene/Scene.js, line 374 -
readonlydebugFrustumStatistics :Object
-
This property is for debugging only; it is not for production use.
When
Scene.debugShowFrustumsistrue, this contains properties with statistics about the number of command execute per frustum.totalCommandsis the total number of commands executed, ignoring overlap.commandsInFrustumsis an array with the number of times commands are executed redundantly, e.g., how many commands overlap two or three frustums.-
Default Value:
undefinedSource: Scene/Scene.js, line 718 -
debugShowCommands :Boolean
-
This property is for debugging only; it is not for production use.
When
true, commands are randomly shaded. This is useful for performance analysis to see what parts of a scene or model are command-dense and could benefit from batching.-
Default Value:
falseSource: Scene/Scene.js, line 388 -
debugShowFramesPerSecond :Boolean
-
This property is for debugging only; it is not for production use.
Displays frames per second and time between frames.
-
Default Value:
falseSource: Scene/Scene.js, line 419 -
debugShowFrustums :Boolean
-
This property is for debugging only; it is not for production use.
When
true, commands are shaded based on the frustums they overlap. Commands in the closest frustum are tinted red, commands in the next closest are green, and commands in the farthest frustum are blue. If a command overlaps more than one frustum, the color components are combined, e.g., a command overlapping the first two frustums is tinted yellow.-
Default Value:
falseSource: Scene/Scene.js, line 405 -
readonlydrawingBufferHeight :Number
-
The drawingBufferWidth of the underlying GL context.
See:
Source: Scene/Scene.js, line 480 -
readonlydrawingBufferWidth :Number
-
The drawingBufferHeight of the underlying GL context.
See:
Source: Scene/Scene.js, line 495 -
farToNearRatio :Number
-
The far-to-near ratio of the multi-frustum. The default is 1,000.0.
-
Default Value:
1000.0Source: Scene/Scene.js, line 342 -
readonlyframeState :FrameState
-
Gets state information about the current scene. If called outside of a primitive's
updatefunction, the previous frame's state is returned.Source: Scene/Scene.js, line 596 -
fxaa :Boolean
-
When
true, enables Fast Approximate Anti-aliasing even when order independent translucency is unsupported.-
Default Value:
falseSource: Scene/Scene.js, line 437 -
fxaaOrderIndependentTranslucency :Boolean
-
If
true, enables Fast Aproximate Anti-aliasing only if order independent translucency is supported.-
Default Value:
trueSource: Scene/Scene.js, line 428 -
globe :Globe
-
Gets or sets the depth-test ellipsoid.Source: Scene/Scene.js, line 522
-
readonlyimageryLayers :ImageryLayerCollection
-
Gets the collection of image layers that will be rendered on the globe.Source: Scene/Scene.js, line 624
-
readonlymapProjection :MapProjection
-
Get the map projection to use in 2D and Columbus View modes.
-
Default Value:
new GeographicProjection()Source: Scene/Scene.js, line 582 -
readonlymaximumAliasedLineWidth :Number
-
The maximum aliased line width, in pixels, supported by this WebGL implementation. It will be at least one.
- glGet with
ALIASED_LINE_WIDTH_RANGE.
See:
Source: Scene/Scene.js, line 510 - glGet with
-
mode :SceneMode
-
The current mode of the scene.
-
Default Value:
SceneMode.SCENE3DSource: Scene/Scene.js, line 324 -
moon :Moon
-
The
Moon-
Default Value:
undefinedSource: Scene/Scene.js, line 306 -
morphComplete :Event
-
The event fired at the completion of a scene transition.
-
Default Value:
Event()Source: Scene/Scene.js, line 263 -
morphStart :Event
-
The event fired at the beginning of a scene transition.
-
Default Value:
Event()Source: Scene/Scene.js, line 256 -
morphTime :Number
-
The current morph transition time between 2D/Columbus View and 3D, with 0.0 being 2D or Columbus View and 1.0 being 3D.
-
Default Value:
1.0Source: Scene/Scene.js, line 335 -
readonlypostRender :Event
-
Gets the event that will be raised at the end of each call to
render. Subscribers to the event receive the Scene instance as the first parameter and the current time as the second parameter.Source: Scene/Scene.js, line 684 -
readonlypreRender :Event
-
Gets the event that will be raised at the start of each call to
render. Subscribers to the event receive the Scene instance as the first parameter and the current time as the second parameter.Source: Scene/Scene.js, line 670 -
readonlyprimitives :PrimitiveCollection
-
Gets the collection of primitives.Source: Scene/Scene.js, line 540
-
readonlyrenderError :Event
-
Gets the event that will be raised when an error is thrown inside the
renderfunction. The Scene instance and the thrown error are the only two parameters passed to the event handler. By default, errors are not rethrown after this event is raised, but that can be changed by setting therethrowRenderErrorsproperty.Source: Scene/Scene.js, line 656 -
rethrowRenderErrors :Boolean
-
Exceptions occurring in
renderare always caught in order to raise therenderErrorevent. If this property is true, the error is rethrown after the event is raised. If this property is false, therenderfunction returns normally after raising the event.-
Default Value:
falseSource: Scene/Scene.js, line 240 -
readonlyscreenSpaceCameraController :ScreenSpaceCameraController
-
Gets the controller for camera input handling.Source: Scene/Scene.js, line 567
-
skyAtmosphere :SkyAtmosphere
-
The sky atmosphere drawn around the globe.
-
Default Value:
undefinedSource: Scene/Scene.js, line 281 -
skyBox :SkyBox
-
The
SkyBoxused to draw the stars.-
Default Value:
undefinedSee:
Source: Scene/Scene.js, line 273 -
sun :Sun
-
The
Sun.-
Default Value:
undefinedSource: Scene/Scene.js, line 289 -
sunBloom :Boolean
-
Uses a bloom filter on the sun when enabled.
-
Default Value:
trueSource: Scene/Scene.js, line 297 -
readonlyterrainProvider :TerrainProvider
-
The terrain provider providing surface geometry for the globe.Source: Scene/Scene.js, line 637
Methods
-
completeMorph()
-
Instantly completes an active transition.Source: Scene/Scene.js, line 1568
-
destroy() → undefined
-
Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.
Once an object is destroyed, it should not be used; calling any function other thanisDestroyedwill result in aDeveloperErrorexception. Therefore, assign the return value (undefined) to the object as done in the example.Returns:
Throws:
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
scene = scene && scene.destroy();See:
Source: Scene/Scene.js, line 1639 -
-
drillPick(windowPosition) → Array.<Object>
-
Returns a list of objects, each containing a `primitive` property, for all primitives at a particular window coordinate position. Other properties may also be set depending on the type of primitive. The primitives in the list are ordered by their visual order in the scene (front to back).
Name Type Description windowPositionCartesian2 Window coordinates to perform picking on. Returns:
Array of objects, each containing 1 picked primitives.Throws:
-
DeveloperError : windowPosition is undefined.
Example:
var pickedObjects = Cesium.Scene.drillPick(new Cesium.Cartesian2(100.0, 200.0));Source: Scene/Scene.js, line 1518 -
-
isDestroyed() → Boolean
-
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other thanisDestroyedwill result in aDeveloperErrorexception.Returns:
trueif this object was destroyed; otherwise,false.See:
Source: Scene/Scene.js, line 1618 -
morphTo2D(duration)
-
Asynchronously transitions the scene to 2D.
Name Type Default Description durationNumber 2.0optional The amount of time, in seconds, for transition animations to complete. Source: Scene/Scene.js, line 1576 -
morphTo3D(duration)
-
Asynchronously transitions the scene to 3D.
Name Type Default Description durationNumber 2.0optional The amount of time, in seconds, for transition animations to complete. Source: Scene/Scene.js, line 1600 -
morphToColumbusView(duration)
-
Asynchronously transitions the scene to Columbus View.
Name Type Default Description durationNumber 2.0optional The amount of time, in seconds, for transition animations to complete. Source: Scene/Scene.js, line 1588 -
pick(windowPosition) → Object
-
Returns an object with a `primitive` property that contains the first (top) primitive in the scene at a particular window coordinate or undefined if nothing is at the location. Other properties may potentially be set depending on the type of primitive.
Name Type Description windowPositionCartesian2 Window coordinates to perform picking on. Returns:
Object containing the picked primitive.Throws:
-
DeveloperError : windowPosition is undefined.
Source: Scene/Scene.js, line 1466 -
