new Cesium.loadCubeMap(context, urls, allowCrossOrigin) → Promise.<CubeMap>
Asynchronously loads six images and creates a cube map. Returns a promise that
will resolve to a
CubeMap
once loaded, or reject if any image fails to load.
Name | Type | Default | Description |
---|---|---|---|
context |
Context | The context to use to create the cube map. | |
urls |
Object | The source URL of each image. See the example below. | |
allowCrossOrigin |
Boolean |
true
|
optional Whether to request the image using Cross-Origin Resource Sharing (CORS). CORS is only actually used if the image URL is actually cross-origin. Data URIs are never requested using CORS. |
Returns:
a promise that will resolve to the requested
CubeMap
when loaded.
Throws:
-
DeveloperError : context is required.
-
DeveloperError : urls is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.
Example:
Cesium.loadCubeMap(context, {
positiveX : 'skybox_px.png',
negativeX : 'skybox_nx.png',
positiveY : 'skybox_py.png',
negativeY : 'skybox_ny.png',
positiveZ : 'skybox_pz.png',
negativeZ : 'skybox_nz.png'
}).then(function(cubeMap) {
// use the cubemap
}).otherwise(function(error) {
// an error occurred
});