new Scene(optionsopt)
CesiumWidget
.
contextOptions
parameter details:
The default values are:
{
webgl : {
alpha : false,
depth : true,
stencil : false,
antialias : true,
premultipliedAlpha : true,
preserveDrawingBuffer : false,
failIfMajorPerformanceCaveat : false
},
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.
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.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Object with the following properties:
Properties
|
- Source:
- See:
Throws:
-
options and options.canvas are required.
- Type
- DeveloperError
Example
// Create scene without anisotropic texture filtering
var scene = new Cesium.Scene({
canvas : canvas,
contextOptions : {
allowTextureFilterAnisotropic : false
}
});
Members
backgroundColor :Color
Scene#skyBox
is undefined.
Type:
- Default Value:
- Source:
- See:
(readonly) camera :Camera
Type:
- Source:
(readonly) canvas :Canvas
Type:
- Canvas
- Source:
completeMorphOnUserInput :Boolean
Type:
- Boolean
- Default Value:
- true
- Source:
debugCommandFilter :function
A function that determines what commands are executed. As shown in the examples below,
the function receives the command's owner
as an argument, and returns a boolean indicating if the
command should be executed.
The default is undefined
, indicating that all commands are executed.
Type:
- function
- Default Value:
- undefined
- Source:
Example
// 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;
};
(readonly) debugFrustumStatistics :Object
When Scene.debugShowFrustums
is true
, this contains
properties with statistics about the number of command execute per frustum.
totalCommands
is the total number of commands executed, ignoring
overlap. commandsInFrustums
is an array with the number of times
commands are executed redundantly, e.g., how many commands overlap two or
three frustums.
Type:
- Object
- Default Value:
- undefined
- Source:
debugShowCommands :Boolean
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.
Type:
- Boolean
- Default Value:
- false
- Source:
debugShowDepthFrustum :Number
Indicates which frustum will have depth information displayed.
Type:
- Number
- Default Value:
- 1
- Source:
debugShowFramesPerSecond :Boolean
Displays frames per second and time between frames.
Type:
- Boolean
- Default Value:
- false
- Source:
debugShowFrustums :Boolean
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.
Type:
- Boolean
- Default Value:
- false
- Source:
debugShowGlobeDepth :Boolean
Displays depth information for the indicated frustum.
Type:
- Boolean
- Default Value:
- false
- Source:
(readonly) drawingBufferHeight :Number
Type:
- Number
- Source:
- See:
(readonly) drawingBufferWidth :Number
Type:
- Number
- Source:
- See:
farToNearRatio :Number
Type:
- Number
- Default Value:
- 1000.0
- Source:
fog :Fog
Type:
- Source:
fxaa :Boolean
true
, enables Fast Approximate Anti-aliasing even when order independent translucency
is unsupported.
Type:
- Boolean
- Default Value:
- true
- Source:
globe :Globe
Type:
- Source:
(readonly) groundPrimitives :PrimitiveCollection
Type:
- Source:
(readonly) id :String
Type:
- String
- Source:
(readonly) imageryLayers :ImageryLayerCollection
Type:
- Source:
mapMode2D :Boolean
Type:
- Boolean
- Source:
(readonly) mapProjection :MapProjection
Type:
- Default Value:
- new GeographicProjection()
- Source:
(readonly) maximumAliasedLineWidth :Number
Type:
- Number
- Source:
- See:
-
- glGet with
ALIASED_LINE_WIDTH_RANGE
.
- glGet with
(readonly) maximumCubeMapSize :Number
Type:
- Number
- Source:
- See:
-
- glGet with
GL_MAX_CUBE_MAP_TEXTURE_SIZE
.
- glGet with
mode :SceneMode
Type:
- SceneMode
- Default Value:
SceneMode.SCENE3D
- Source:
moon :Moon
Moon
Type:
- Default Value:
- undefined
- Source:
morphComplete :Event
Type:
- Default Value:
- Event()
- Source:
morphStart :Event
Type:
- Default Value:
- Event()
- Source:
morphTime :Number
Type:
- Number
- Default Value:
- 1.0
- Source:
nearToFarDistance2D :Number
Type:
- Number
- Default Value:
- 1.75e6
- Source:
(readonly) orderIndependentTranslucency :Boolean
Type:
- Boolean
- Source:
(readonly) pickPositionSupported :Boolean
Type:
- Boolean
- Source:
(readonly) postRender :Event
render
. Subscribers to the event
receive the Scene instance as the first parameter and the current time as the second parameter.
Type:
- Source:
(readonly) preRender :Event
render
. Subscribers to the event
receive the Scene instance as the first parameter and the current time as the second parameter.
Type:
- Source:
(readonly) primitives :PrimitiveCollection
Type:
- Source:
(readonly) renderError :Event
render
function.
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
the rethrowRenderErrors
property.
Type:
- Source:
rethrowRenderErrors :Boolean
render
are always caught in order to raise the
renderError
event. If this property is true, the error is rethrown
after the event is raised. If this property is false, the render
function
returns normally after raising the event.
Type:
- Boolean
- Default Value:
- false
- Source:
(readonly) scene3DOnly :Boolean
Type:
- Boolean
- Source:
(readonly) screenSpaceCameraController :ScreenSpaceCameraController
Type:
- Source:
shadowMap :ShadowMap
Type:
- Source:
skyAtmosphere :SkyAtmosphere
Type:
- Default Value:
- undefined
- Source:
skyBox :SkyBox
SkyBox
used to draw the stars.
Type:
- Default Value:
- undefined
- Source:
- See:
sun :Sun
Sun
.
Type:
- Default Value:
- undefined
- Source:
sunBloom :Boolean
Type:
- Boolean
- Default Value:
- true
- Source:
terrainExaggeration :Number
Type:
- Number
- Source:
terrainProvider :TerrainProvider
Type:
- Source:
(readonly) terrainProviderChanged :Event
Type:
- Source:
useDepthPicking :Boolean
true
, enables picking using the depth buffer.
Type:
- Boolean
- Default Value:
- true
- Source:
useWebVR :Boolean
true
, splits the scene into two viewports with steroscopic views for the left and right eyes.
Used for cardboard and WebVR.
Type:
- Boolean
- Default Value:
- false
- Source:
Methods
completeMorph()
- Source:
destroy() → {undefined}
Once an object is destroyed, it should not be used; calling any function other than
isDestroyed
will result in a DeveloperError
exception. Therefore,
assign the return value (undefined
) to the object as done in the example.
- Source:
- See:
Throws:
-
This object was destroyed, i.e., destroy() was called.
- Type
- DeveloperError
Returns:
- Type
- undefined
Example
scene = scene && scene.destroy();
drillPick(windowPosition, limitopt) → {Array.<Object>}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
windowPosition |
Cartesian2 | Window coordinates to perform picking on. | |
limit |
Number |
<optional> |
If supplied, stop drilling after collecting this many picks. |
- Source:
Throws:
-
windowPosition is undefined.
- Type
- DeveloperError
Returns:
- Type
- Array.<Object>
Example
var pickedObjects = scene.drillPick(new Cesium.Cartesian2(100.0, 200.0));
isDestroyed() → {Boolean}
If this object was destroyed, it should not be used; calling any function other than
isDestroyed
will result in a DeveloperError
exception.
- Source:
- See:
Returns:
true
if this object was destroyed; otherwise, false
.
- Type
- Boolean
morphTo2D(durationopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
duration |
Number |
<optional> |
2.0 | The amount of time, in seconds, for transition animations to complete. |
- Source:
morphTo3D(durationopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
duration |
Number |
<optional> |
2.0 | The amount of time, in seconds, for transition animations to complete. |
- Source:
morphToColumbusView(durationopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
duration |
Number |
<optional> |
2.0 | The amount of time, in seconds, for transition animations to complete. |
- Source:
pick(windowPosition) → {Object}
Parameters:
Name | Type | Description |
---|---|---|
windowPosition |
Cartesian2 | Window coordinates to perform picking on. |
- Source:
Throws:
-
windowPosition is undefined.
- Type
- DeveloperError
Returns:
- Type
- Object
pickPosition(windowPosition, resultopt) → {Cartesian3}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
windowPosition |
Cartesian2 | Window coordinates to perform picking on. | |
result |
Cartesian3 |
<optional> |
The object on which to restore the result. |
- Source:
Throws:
-
-
Picking from the depth buffer is not supported. Check pickPositionSupported.
- Type
- DeveloperError
-
-
-
2D is not supported. An orthographic projection matrix is not invertible.
- Type
- DeveloperError
-
Returns:
- Type
- Cartesian3