new Model(options)
Cesium includes support for geometry and materials, glTF animations, and glTF skinning.
In addition, individual glTF nodes are pickable with Scene#pick and animatable
with Model#getNode.  glTF cameras and lights are not currently supported.
An external glTF asset is created with Model.fromGltf.  glTF JSON can also be
created at runtime and passed to this constructor function.  In either case, the
Model#readyPromise is resolved when the model is ready to render, i.e.,
when the external binary, image, and shader files are downloaded and the WebGL
resources are created.
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | optional
                
                
                
            
                Object with the following properties: 
 | 
Demo:
See:
Members
- 
    activeAnimations :ModelAnimationCollection
- 
    
    The currently playing glTF animations.Source: Scene/Model.js, line 343
- 
    readonlyallowPicking :Boolean
- 
    
    Whentrue, each glTF mesh and primitive is pickable withScene#pick. Whenfalse, GPU memory is saved.- 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 trueSource: Scene/Model.js, line 644
- 
    readonlyasynchronous :Boolean
- 
    
    Determines if model WebGL resource creation will be spread out over several frames or block until completion once all glTF files are loaded.- 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 trueSource: Scene/Model.js, line 628
- 
    readonlybasePath :String
- 
    
    The base path that paths in the glTF JSON are relative to. The base path is the same path as the path containing the .json file minus the .json file, when binary, image, and shader files are in the same directory as the .json. When this is'', the app's base path is used.- 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 ''Source: Scene/Model.js, line 497
- 
    readonlyboundingSphere :BoundingSphere
- 
    
    The model's bounding sphere in its local coordinate system. This does not take into account glTF animations and skins.- 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 undefinedExample:// Center in WGS84 coordinates var center = Cesium.Matrix4.multiplyByPoint(model.modelMatrix, model.boundingSphere.center, new Cesium.Cartesian3());Source: Scene/Model.js, line 520
- 
    debugShowBoundingVolume :Boolean
- 
    
    This property is for debugging only; it is not for production use nor is it optimized.Draws the bounding sphere for each draw command in the model. A glTF primitive corresponds to one draw command. A glTF mesh has an array of primitives, often of length one. - 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 falseSource: Scene/Model.js, line 358
- 
    debugWireframe :Boolean
- 
    
    This property is for debugging only; it is not for production use nor is it optimized.Draws the model in wireframe. - 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 falseSource: Scene/Model.js, line 371
- 
    readonlygltf :Object
- 
    
    The object for the glTF JSON, including properties with default values omitted from the JSON provided to this model.- 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 undefinedSource: Scene/Model.js, line 432
- 
    id :Object
- 
    
    User-defined object returned when the model is picked.- 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 undefinedSee:Source: Scene/Model.js, line 322
- 
    minimumPixelSize :Number
- 
    
    The approximate minimum pixel size of the model regardless of zoom. This can be used to ensure that a model is visible even when the viewer zooms out. When0.0, no minimum size is enforced.- 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 0.0Source: Scene/Model.js, line 310
- 
    modelMatrix :Matrix4
- 
    
    The 4x4 transformation matrix that transforms the model from model to world coordinates. When this is the identity matrix, the model is drawn in world coordinates, i.e., Earth's WGS84 coordinates. Local reference frames can be used by providing a different transformation matrix, like that returned byTransforms.eastNorthUpToFixedFrame.- 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 Matrix4.IDENTITYExample:var origin = Cesium.Cartesian3.fromDegrees(-95.0, 40.0, 200000.0); m.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(origin);Source: Scene/Model.js, line 286
- 
    readonlyready :Boolean
- 
    
    Whentrue, this model is ready to render, i.e., the external binary, image, and shader files were downloaded and the WebGL resources were created. This is set totrueright beforeModel#readyPromiseis resolved.- 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 falseSee:Source: Scene/Model.js, line 552
- 
    readonlyreadyPromise :Promise
- 
    
    Gets the promise that will be resolved when this model is ready to render, i.e., when the external binary, image, and shader files were downloaded and the WebGL resources were created.This promise is resolved at the end of the frame before the first frame the model is rendered in. - 
    
    
    
    
    
    Deprecated:
    true
    
    
    
    
    
    
        
 Example:// Play all animations at half-speed when the model is ready to render Cesium.when(model.readyPromise).then(function(model) { model.activeAnimations.addAll({ speedup : 0.5 }); }).otherwise(function(error){ window.alert(error); });See:Source: Scene/Model.js, line 611
- 
    readonlyreadyToRender :Event
- 
    
    The event fired when this model is ready to render, i.e., when the external binary, image, and shader files were downloaded and the WebGL resources were created.This event is fired at the end of the frame before the first frame the model is rendered in. - 
    
    
    
    
    
    Deprecated:
    true
    
    
    
    
    
    
        
 Example:// Play all animations at half-speed when the model is ready to render model.readyToRender.addEventListener(function(model) { model.activeAnimations.addAll({ speedup : 0.5 }); });See:Source: Scene/Model.js, line 580
- 
    scale :Number
- 
    
    A uniform scale applied to this model before theModel#modelMatrix. Values greater than1.0increase the size of the model; values less than1.0decrease.- 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 1.0Source: Scene/Model.js, line 298
- 
    show :Boolean
- 
    
    Determines if the model primitive will be shown.- 
    
    
    
    
    
    
    
    
    
    Default Value:
    
 trueSource: Scene/Model.js, line 270
Methods
- 
    staticModel.fromGltf(options) → Model
- 
    
    Creates a model from a glTF asset. When the model is ready to render, i.e., when the external binary, image, and shader files are downloaded and the WebGL resources are created, theModel#readyPromiseis resolved.Name Type Description optionsObject Object with the following properties: Name Type Default Description urlString The url to the .gltf file. headersObject optional HTTP headers to send with the request. showBoolean trueoptional Determines if the model primitive will be shown. modelMatrixMatrix4 Matrix4.IDENTITYoptional The 4x4 transformation matrix that transforms the model from model to world coordinates. scaleNumber 1.0optional A uniform scale applied to this model. minimumPixelSizeNumber 0.0optional The approximate minimum pixel size of the model regardless of zoom. allowPickingBoolean trueoptional When true, each glTF mesh and primitive is pickable withScene#pick.asynchronousBoolean trueoptional Determines if model WebGL resource creation will be spread out over several frames or block until completion once all glTF files are loaded. debugShowBoundingVolumeBoolean falseoptional For debugging only. Draws the bounding sphere for each DrawCommandin the model.debugWireframeBoolean falseoptional For debugging only. Draws the model in wireframe. Returns:The newly created model.Examples:// Example 1. Create a model from a glTF asset var model = scene.primitives.add(Cesium.Model.fromGltf({ url : './duck/duck.json' }));// Example 2. Create model and provide all properties and events var origin = Cesium.Cartesian3.fromDegrees(-95.0, 40.0, 200000.0); var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(origin); var model = scene.primitives.add(Model.fromGltf({ url : './duck/duck.json', show : true, // default modelMatrix : modelMatrix, scale : 2.0, // double size minimumPixelSize : 128, // never smaller than 128 pixels allowPicking : false, // not pickable debugShowBoundingVolume : false, // default debugWireframe : false })); model.readyPromise.then(function(model) { // Play all animations when the model is ready to render model.activeAnimations.addAll(); });See:Source: Scene/Model.js, line 697
- 
    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:model = model && model.destroy();See:Source: Scene/Model.js, line 2733
- 
    
- 
    getMaterial(name) → ModelMaterial
- 
    
    Returns the glTF material with the givennameproperty.Name Type Description nameString The glTF name of the material. Returns:The material orundefinedif no material withnameexists.Throws:- 
    DeveloperError : The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true.
 Source: Scene/Model.js, line 820
- 
    
- 
    getMesh(name) → ModelMesh
- 
    
    Returns the glTF mesh with the givennameproperty.Name Type Description nameString The glTF name of the mesh. Returns:The mesh orundefinedif no mesh withnameexists.Throws:- 
    DeveloperError : The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true.
 Source: Scene/Model.js, line 808
- 
    
- 
    getNode(name) → ModelNode
- 
    
    Returns the glTF node with the givennameproperty. This is used to modify a node's transform for animation outside of glTF animations.Name Type Description nameString The glTF name of the node. Returns:The node orundefinedif no node withnameexists.Throws:- 
    DeveloperError : The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true.
 Example:// Apply non-uniform scale to node LOD3sp var node = model.getNode('LOD3sp'); node.matrix =Cesium. Matrix4.fromScale(new Cesium.Cartesian3(5.0, 1.0, 1.0), node.matrix);Source: Scene/Model.js, line 794
- 
    
- 
    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/Model.js, line 2712
- 
    update()
- 
    
    Called whenViewerorCesiumWidgetrender the scene to get the draw commands needed to render this primitive.Do not call this function directly. This is documented just to list the exceptions that may be propagated when the scene is rendered: Throws:- 
    RuntimeError : Failed to load external reference.
 Source: Scene/Model.js, line 2540
- 
    
