mars3d-cesium 1.87.0 → 1.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Cesium/Cesium.d.ts +647 -0
- package/Build/Cesium/Cesium.js +3 -3
- package/package.json +1 -1
package/Build/Cesium/Cesium.d.ts
CHANGED
|
@@ -6387,6 +6387,23 @@ export namespace EventHelper {
|
|
|
6387
6387
|
type RemoveCallback = () => void;
|
|
6388
6388
|
}
|
|
6389
6389
|
|
|
6390
|
+
/**
|
|
6391
|
+
* Flags to enable experimental features in CesiumJS. Stability and performance
|
|
6392
|
+
may not be optimal when these are enabled. Experimental features are subject
|
|
6393
|
+
to change without Cesium's standard deprecation policy.
|
|
6394
|
+
<p>
|
|
6395
|
+
Experimental features must still uphold Cesium's quality standards. Here
|
|
6396
|
+
are some guidelines:
|
|
6397
|
+
</p>
|
|
6398
|
+
<ul>
|
|
6399
|
+
<li>Experimental features must have high unit test coverage like any other feature.</li>
|
|
6400
|
+
<li>Experimental features are intended for large features where there is benefit of merging some of the code sooner (e.g. to avoid long-running staging branches)</li>
|
|
6401
|
+
<li>Experimental flags should be short-lived. Make it clear in the PR what it would take to promote the feature to a regular feature.</li>
|
|
6402
|
+
<li>To avoid cluttering the code, check the flag in as few places as possible. Ideally this would be a single place.</li>
|
|
6403
|
+
</ul>
|
|
6404
|
+
*/
|
|
6405
|
+
export var ExperimentalFeatures: any;
|
|
6406
|
+
|
|
6390
6407
|
/**
|
|
6391
6408
|
* Constants to determine how an interpolated value is extrapolated
|
|
6392
6409
|
when querying outside the bounds of available data.
|
|
@@ -26831,6 +26848,35 @@ export class Cesium3DTileFeature {
|
|
|
26831
26848
|
* @returns The value of the property or <code>undefined</code> if the feature does not have this property.
|
|
26832
26849
|
*/
|
|
26833
26850
|
getProperty(name: string): any;
|
|
26851
|
+
/**
|
|
26852
|
+
* Returns a copy of the feature's property with the given name, examining all
|
|
26853
|
+
the metadata from 3D Tiles 1.0 formats, the EXT_mesh_features and legacy
|
|
26854
|
+
EXT_feature_metadata glTF extensions, and the 3DTILES_metadata 3D Tiles
|
|
26855
|
+
extension. Metadata is checked against name from most specific to most
|
|
26856
|
+
general and the first match is returned. Metadata is checked in this order:
|
|
26857
|
+
|
|
26858
|
+
<ol>
|
|
26859
|
+
<li>Batch table (feature metadata) property by semantic</li>
|
|
26860
|
+
<li>Batch table (feature metadata) property by property ID</li>
|
|
26861
|
+
<li>Tile metadata property by semantic</li>
|
|
26862
|
+
<li>Tile metadata property by property ID</li>
|
|
26863
|
+
<li>Group metadata property by semantic</li>
|
|
26864
|
+
<li>Group metadata property by property ID</li>
|
|
26865
|
+
<li>Tileset metadata property by semantic</li>
|
|
26866
|
+
<li>Tileset metadata property by property ID</li>
|
|
26867
|
+
<li>Otherwise, return undefined</li>
|
|
26868
|
+
</ol>
|
|
26869
|
+
<p>
|
|
26870
|
+
For 3D Tiles Next details, see the {@link https://github.com/CesiumGS/3d-tiles/tree/3d-tiles-next/extensions/3DTILES_metadata|3DTILES_metadata Extension}
|
|
26871
|
+
for 3D Tiles, as well as the {@link https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features|EXT_mesh_features Extension}
|
|
26872
|
+
for glTF. For the legacy glTF extension, see {@link https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata|EXT_feature_metadata Extension}
|
|
26873
|
+
</p>
|
|
26874
|
+
* @param content - The content for accessing the metadata
|
|
26875
|
+
* @param batchId - The batch ID (or feature ID) of the feature to get a property for
|
|
26876
|
+
* @param name - The semantic or property ID of the feature. Semantics are checked before property IDs in each granularity of metadata.
|
|
26877
|
+
* @returns The value of the property or <code>undefined</code> if the feature does not have this property.
|
|
26878
|
+
*/
|
|
26879
|
+
static getPropertyInherited(content: Cesium3DTileContent, batchId: number, name: string): any;
|
|
26834
26880
|
/**
|
|
26835
26881
|
* Sets the value of the feature's property with the given name.
|
|
26836
26882
|
<p>
|
|
@@ -27741,6 +27787,15 @@ export class Cesium3DTileset {
|
|
|
27741
27787
|
});
|
|
27742
27788
|
*/
|
|
27743
27789
|
style: Cesium3DTileStyle | undefined;
|
|
27790
|
+
/**
|
|
27791
|
+
* A custom shader to apply to all tiles in the tileset. Only used for
|
|
27792
|
+
contents that use {@link ModelExperimental}. Using custom shaders with a
|
|
27793
|
+
{@link Cesium3DTileStyle} may lead to undefined behavior.
|
|
27794
|
+
<p>
|
|
27795
|
+
To enable {@link ModelExperimental}, set {@link ExperimentalFeatures.enableModelExperimental} to <code>true</code>.
|
|
27796
|
+
</p>
|
|
27797
|
+
*/
|
|
27798
|
+
customShader: CustomShader | undefined;
|
|
27744
27799
|
/**
|
|
27745
27800
|
* The maximum screen space error used to drive level of detail refinement. This value helps determine when a tile
|
|
27746
27801
|
refines to its descendants, and therefore plays a major role in balancing performance with visual quality.
|
|
@@ -34886,6 +34941,354 @@ export enum ModelAnimationLoop {
|
|
|
34886
34941
|
MIRRORED_REPEAT = 2
|
|
34887
34942
|
}
|
|
34888
34943
|
|
|
34944
|
+
/**
|
|
34945
|
+
* An object describing a uniform, its type, and an initial value
|
|
34946
|
+
* @property type - The Glsl type of the uniform.
|
|
34947
|
+
* @property value - The initial value of the uniform
|
|
34948
|
+
*/
|
|
34949
|
+
export type UniformSpecifier = {
|
|
34950
|
+
type: UniformType;
|
|
34951
|
+
value: boolean | number | Cartesian2 | Cartesian3 | Cartesian4 | Matrix2 | Matrix3 | Matrix4 | TextureUniform;
|
|
34952
|
+
};
|
|
34953
|
+
|
|
34954
|
+
/**
|
|
34955
|
+
* A user defined GLSL shader used with {@link ModelExperimental} as well
|
|
34956
|
+
as {@link Cesium3DTileset}.
|
|
34957
|
+
<p>
|
|
34958
|
+
If texture uniforms are used, additional resource management must be done:
|
|
34959
|
+
</p>
|
|
34960
|
+
<ul>
|
|
34961
|
+
<li>
|
|
34962
|
+
The <code>update</code> function must be called each frame. When a
|
|
34963
|
+
custom shader is passed to a {@link ModelExperimental} or a
|
|
34964
|
+
{@link Cesium3DTileset}, this step is handled automaticaly
|
|
34965
|
+
</li>
|
|
34966
|
+
<li>
|
|
34967
|
+
{@link CustomShader#destroy} must be called when the custom shader is
|
|
34968
|
+
no longer needed to clean up GPU resources properly. The application
|
|
34969
|
+
is responsible for calling this method.
|
|
34970
|
+
</li>
|
|
34971
|
+
</ul>
|
|
34972
|
+
<p>
|
|
34973
|
+
To enable the use of {@link ModelExperimental} in {@link Cesium3DTileset}, set {@link ExperimentalFeatures.enableModelExperimental} to <code>true</code>.
|
|
34974
|
+
</p>
|
|
34975
|
+
* @example
|
|
34976
|
+
* var customShader = new CustomShader({
|
|
34977
|
+
uniforms: {
|
|
34978
|
+
u_colorIndex: {
|
|
34979
|
+
type: Cesium.UniformType.FLOAT,
|
|
34980
|
+
value: 1.0
|
|
34981
|
+
},
|
|
34982
|
+
u_normalMap: {
|
|
34983
|
+
type: Cesium.UniformType.SAMPLER_2D,
|
|
34984
|
+
value: new Cesium.TextureUniform({
|
|
34985
|
+
url: "http://example.com/normal.png"
|
|
34986
|
+
})
|
|
34987
|
+
}
|
|
34988
|
+
},
|
|
34989
|
+
varyings: {
|
|
34990
|
+
v_selectedColor: Cesium.VaryingType.VEC3
|
|
34991
|
+
},
|
|
34992
|
+
vertexShaderText: `
|
|
34993
|
+
void vertexMain(VertexInput vsInput, inout vec3 position) {
|
|
34994
|
+
v_selectedColor = mix(vsInput.attributes.color_0, vsInput.attributes.color_1, u_colorIndex);
|
|
34995
|
+
position += 0.1 * vsInput.attributes.normal;
|
|
34996
|
+
}
|
|
34997
|
+
`,
|
|
34998
|
+
fragmentShaderText: `
|
|
34999
|
+
void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {
|
|
35000
|
+
material.normal = texture2D(u_normalMap, fsInput.attributes.texCoord_0);
|
|
35001
|
+
material.diffuse = v_selectedColor;
|
|
35002
|
+
}
|
|
35003
|
+
`
|
|
35004
|
+
});
|
|
35005
|
+
* @param options - An object with the following options
|
|
35006
|
+
* @param [options.mode = CustomShaderMode.MODIFY_MATERIAL] - The custom shader mode, which determines how the custom shader code is inserted into the fragment shader.
|
|
35007
|
+
* @param [options.lightingModel] - The lighting model (e.g. PBR or unlit). If present, this overrides the default lighting for the model.
|
|
35008
|
+
* @param [options.isTranslucent = false] - If set, the model will be rendered as translucent. This overrides the default settings for the model.
|
|
35009
|
+
* @param [options.uniforms] - A dictionary for user-defined uniforms. The key is the uniform name that will appear in the GLSL code. The value is an object that describes the uniform type and initial value
|
|
35010
|
+
* @param [options.varyings] - A dictionary for declaring additional GLSL varyings used in the shader. The key is the varying name that will appear in the GLSL code. The value is the data type of the varying. For each varying, the declaration will be added to the top of the shader automatically. The caller is responsible for assigning a value in the vertex shader and using the value in the fragment shader.
|
|
35011
|
+
* @param [options.vertexShaderText] - The custom vertex shader as a string of GLSL code. It must include a GLSL function called vertexMain. See the example for the expected signature. If not specified, the custom vertex shader step will be skipped in the computed vertex shader.
|
|
35012
|
+
* @param [options.fragmentShaderText] - The custom fragment shader as a string of GLSL code. It must include a GLSL function called fragmentMain. See the example for the expected signature. If not specified, the custom fragment shader step will be skipped in the computed fragment shader.
|
|
35013
|
+
*/
|
|
35014
|
+
export class CustomShader {
|
|
35015
|
+
constructor(options: {
|
|
35016
|
+
mode?: CustomShaderMode;
|
|
35017
|
+
lightingModel?: LightingModel;
|
|
35018
|
+
isTranslucent?: boolean;
|
|
35019
|
+
uniforms?: {
|
|
35020
|
+
[key: string]: UniformSpecifier;
|
|
35021
|
+
};
|
|
35022
|
+
varyings?: {
|
|
35023
|
+
[key: string]: VaryingType;
|
|
35024
|
+
};
|
|
35025
|
+
vertexShaderText?: string;
|
|
35026
|
+
fragmentShaderText?: string;
|
|
35027
|
+
});
|
|
35028
|
+
/**
|
|
35029
|
+
* Update the value of a uniform declared in the shader
|
|
35030
|
+
* @param uniformName - The GLSL name of the uniform. This must match one of the uniforms declared in the constructor
|
|
35031
|
+
* @param value - The new value of the uniform.
|
|
35032
|
+
*/
|
|
35033
|
+
setUniform(uniformName: string, value: boolean | number | Cartesian2 | Cartesian3 | Cartesian4 | Matrix2 | Matrix3 | Matrix4 | string | Resource): void;
|
|
35034
|
+
}
|
|
35035
|
+
|
|
35036
|
+
/**
|
|
35037
|
+
* A value determining how the custom shader interacts with the overall
|
|
35038
|
+
fragment shader. This is used by {@link CustomShaderPipelineStage}
|
|
35039
|
+
*/
|
|
35040
|
+
export const mode: CustomShaderMode;
|
|
35041
|
+
|
|
35042
|
+
/**
|
|
35043
|
+
* The lighting model to use when using the custom shader.
|
|
35044
|
+
This is used by {@link CustomShaderPipelineStage}
|
|
35045
|
+
*/
|
|
35046
|
+
export const lightingModel: LightingModel;
|
|
35047
|
+
|
|
35048
|
+
/**
|
|
35049
|
+
* Additional uniforms as declared by the user.
|
|
35050
|
+
*/
|
|
35051
|
+
export const uniforms: {
|
|
35052
|
+
[key: string]: UniformSpecifier;
|
|
35053
|
+
};
|
|
35054
|
+
|
|
35055
|
+
/**
|
|
35056
|
+
* Additional varyings as declared by the user.
|
|
35057
|
+
This is used by {@link CustomShaderPipelineStage}
|
|
35058
|
+
*/
|
|
35059
|
+
export const varyings: {
|
|
35060
|
+
[key: string]: VaryingType;
|
|
35061
|
+
};
|
|
35062
|
+
|
|
35063
|
+
/**
|
|
35064
|
+
* The user-defined GLSL code for the vertex shader
|
|
35065
|
+
*/
|
|
35066
|
+
export const vertexShaderText: string;
|
|
35067
|
+
|
|
35068
|
+
/**
|
|
35069
|
+
* The user-defined GLSL code for the fragment shader
|
|
35070
|
+
*/
|
|
35071
|
+
export const fragmentShaderText: string;
|
|
35072
|
+
|
|
35073
|
+
/**
|
|
35074
|
+
* Whether the shader should be rendered as translucent
|
|
35075
|
+
*/
|
|
35076
|
+
export const isTranslucent: boolean;
|
|
35077
|
+
|
|
35078
|
+
/**
|
|
35079
|
+
* An enum describing how the {@link CustomShader} will be added to the
|
|
35080
|
+
fragment shader. This determines how the shader interacts with the material.
|
|
35081
|
+
*/
|
|
35082
|
+
export enum CustomShaderMode {
|
|
35083
|
+
/**
|
|
35084
|
+
* The custom shader will be used to modify the results of the material stage
|
|
35085
|
+
before lighting is applied.
|
|
35086
|
+
*/
|
|
35087
|
+
MODIFY_MATERIAL = "MODIFY_MATERIAL",
|
|
35088
|
+
/**
|
|
35089
|
+
* The custom shader will be used instead of the material stage. This is a hint
|
|
35090
|
+
to optimize out the material processing code.
|
|
35091
|
+
*/
|
|
35092
|
+
REPLACE_MATERIAL = "REPLACE_MATERIAL"
|
|
35093
|
+
}
|
|
35094
|
+
|
|
35095
|
+
/**
|
|
35096
|
+
* The lighting model to use for lighting a {@link ModelExperimental}.
|
|
35097
|
+
*/
|
|
35098
|
+
export enum LightingModel {
|
|
35099
|
+
/**
|
|
35100
|
+
* Use unlit shading, i.e. skip lighting calculations. The model's
|
|
35101
|
+
diffuse color (assumed to be linear RGB, not sRGB) is used directly
|
|
35102
|
+
when computing <code>gl_FragColor</code>. The alpha mode is still
|
|
35103
|
+
applied.
|
|
35104
|
+
*/
|
|
35105
|
+
UNLIT = 0,
|
|
35106
|
+
/**
|
|
35107
|
+
* Use physically-based rendering lighting calculations. This includes
|
|
35108
|
+
both PBR metallic roughness and PBR specular glossiness. Image-based
|
|
35109
|
+
lighting is also applied when possible.
|
|
35110
|
+
*/
|
|
35111
|
+
PBR = 1
|
|
35112
|
+
}
|
|
35113
|
+
|
|
35114
|
+
/**
|
|
35115
|
+
* A 3D model. This is a new architecture that is more decoupled than the older {@link Model}. This class is still experimental.
|
|
35116
|
+
<p>
|
|
35117
|
+
Do not call this function directly, instead use the `from` functions to create
|
|
35118
|
+
the Model from your source data type.
|
|
35119
|
+
</p>
|
|
35120
|
+
* @param options - Object with the following properties:
|
|
35121
|
+
* @param options.resource - The Resource to the 3D model.
|
|
35122
|
+
* @param [options.modelMatrix = Matrix4.IDENTITY] - The 4x4 transformation matrix that transforms the model from model to world coordinates.
|
|
35123
|
+
* @param [options.debugShowBoundingVolume = false] - For debugging only. Draws the bounding sphere for each draw command in the model.
|
|
35124
|
+
* @param [options.cull = true] - Whether or not to cull the model using frustum/horizon culling. If the model is part of a 3D Tiles tileset, this property will always be false, since the 3D Tiles culling system is used.
|
|
35125
|
+
* @param [options.opaquePass = Pass.OPAQUE] - The pass to use in the {@link DrawCommand} for the opaque portions of the model.
|
|
35126
|
+
* @param [options.allowPicking = true] - When <code>true</code>, each primitive is pickable with {@link Scene#pick}.
|
|
35127
|
+
* @param [options.customShader] - A custom shader. This will add user-defined GLSL code to the vertex and fragment shaders. Using custom shaders with a {@link Cesium3DTileStyle} may lead to undefined behavior.
|
|
35128
|
+
* @param [options.content] - The tile content this model belongs to. This property will be undefined if model is not loaded as part of a tileset.
|
|
35129
|
+
* @param [options.show = true] - Whether or not to render the model.
|
|
35130
|
+
* @param [options.color] - A color that blends with the model's rendered color.
|
|
35131
|
+
* @param [options.colorBlendMode = ColorBlendMode.HIGHLIGHT] - Defines how the color blends with the model.
|
|
35132
|
+
* @param [options.colorBlendAmount = 0.5] - Value used to determine the color strength when the <code>colorBlendMode</code> is <code>MIX</code>. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two.
|
|
35133
|
+
* @param [options.featureIdAttributeIndex = 0] - The index of the feature ID attribute to use for picking features per-instance or per-primitive.
|
|
35134
|
+
* @param [options.featureIdTextureIndex = 0] - The index of the feature ID texture to use for picking features per-primitive.
|
|
35135
|
+
*/
|
|
35136
|
+
export class ModelExperimental {
|
|
35137
|
+
constructor(options: {
|
|
35138
|
+
resource: Resource;
|
|
35139
|
+
modelMatrix?: Matrix4;
|
|
35140
|
+
debugShowBoundingVolume?: boolean;
|
|
35141
|
+
cull?: boolean;
|
|
35142
|
+
opaquePass?: boolean;
|
|
35143
|
+
allowPicking?: boolean;
|
|
35144
|
+
customShader?: CustomShader;
|
|
35145
|
+
content?: Cesium3DTileContent;
|
|
35146
|
+
show?: boolean;
|
|
35147
|
+
color?: Color;
|
|
35148
|
+
colorBlendMode?: ColorBlendMode;
|
|
35149
|
+
colorBlendAmount?: number;
|
|
35150
|
+
featureIdAttributeIndex?: number;
|
|
35151
|
+
featureIdTextureIndex?: number;
|
|
35152
|
+
});
|
|
35153
|
+
/**
|
|
35154
|
+
* When <code>true</code>, this model is ready to render, i.e., the external binary, image,
|
|
35155
|
+
and shader files were downloaded and the WebGL resources were created. This is set to
|
|
35156
|
+
<code>true</code> right before {@link ModelExperimental#readyPromise} is resolved.
|
|
35157
|
+
*/
|
|
35158
|
+
readonly ready: boolean;
|
|
35159
|
+
/**
|
|
35160
|
+
* Gets the promise that will be resolved when this model is ready to render, i.e. when the external resources
|
|
35161
|
+
have been downloaded and the WebGL resources are created.
|
|
35162
|
+
<p>
|
|
35163
|
+
This promise is resolved at the end of the frame before the first frame the model is rendered in.
|
|
35164
|
+
</p>
|
|
35165
|
+
*/
|
|
35166
|
+
readonly readyPromise: Promise<ModelExperimental>;
|
|
35167
|
+
/**
|
|
35168
|
+
* The model's custom shader, if it exists. Using custom shaders with a {@link Cesium3DTileStyle}
|
|
35169
|
+
may lead to undefined behavior.
|
|
35170
|
+
*/
|
|
35171
|
+
customShader: CustomShader;
|
|
35172
|
+
/**
|
|
35173
|
+
* The color to blend with the model's rendered color.
|
|
35174
|
+
*/
|
|
35175
|
+
color: Color;
|
|
35176
|
+
/**
|
|
35177
|
+
* Defines how the color blends with the model.
|
|
35178
|
+
*/
|
|
35179
|
+
colorBlendMode: Cesium3DTileColorBlendMode | ColorBlendMode;
|
|
35180
|
+
/**
|
|
35181
|
+
* Value used to determine the color strength when the <code>colorBlendMode</code> is <code>MIX</code>. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two.
|
|
35182
|
+
*/
|
|
35183
|
+
colorBlendAmount: number;
|
|
35184
|
+
/**
|
|
35185
|
+
* Gets the model's bounding sphere.
|
|
35186
|
+
*/
|
|
35187
|
+
readonly boundingSphere: BoundingSphere;
|
|
35188
|
+
/**
|
|
35189
|
+
* This property is for debugging only; it is not for production use nor is it optimized.
|
|
35190
|
+
<p>
|
|
35191
|
+
Draws the bounding sphere for each draw command in the model.
|
|
35192
|
+
</p>
|
|
35193
|
+
*/
|
|
35194
|
+
debugShowBoundingVolume: boolean;
|
|
35195
|
+
/**
|
|
35196
|
+
* Whether or not to render the model.
|
|
35197
|
+
*/
|
|
35198
|
+
show: boolean;
|
|
35199
|
+
/**
|
|
35200
|
+
* The index of the feature ID attribute to use for picking features per-instance or per-primitive.
|
|
35201
|
+
*/
|
|
35202
|
+
featureIdAttributeIndex: number;
|
|
35203
|
+
/**
|
|
35204
|
+
* The index of the feature ID texture to use for picking features per-primitive.
|
|
35205
|
+
*/
|
|
35206
|
+
featureIdTextureIndex: number;
|
|
35207
|
+
/**
|
|
35208
|
+
* Called when {@link Viewer} or {@link CesiumWidget} render the scene to
|
|
35209
|
+
get the draw commands needed to render this primitive.
|
|
35210
|
+
<p>
|
|
35211
|
+
Do not call this function directly. This is documented just to
|
|
35212
|
+
list the exceptions that may be propagated when the scene is rendered:
|
|
35213
|
+
</p>
|
|
35214
|
+
*/
|
|
35215
|
+
update(): void;
|
|
35216
|
+
/**
|
|
35217
|
+
* Returns true if this object was destroyed; otherwise, false.
|
|
35218
|
+
<br /><br />
|
|
35219
|
+
If this object was destroyed, it should not be used; calling any function other than
|
|
35220
|
+
<code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
35221
|
+
* @returns <code>true</code> if this object was destroyed; otherwise, <code>false</code>.
|
|
35222
|
+
*/
|
|
35223
|
+
isDestroyed(): boolean;
|
|
35224
|
+
/**
|
|
35225
|
+
* Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
|
|
35226
|
+
release of WebGL resources, instead of relying on the garbage collector to destroy this object.
|
|
35227
|
+
<br /><br />
|
|
35228
|
+
Once an object is destroyed, it should not be used; calling any function other than
|
|
35229
|
+
<code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
|
|
35230
|
+
assign the return value (<code>undefined</code>) to the object as done in the example.
|
|
35231
|
+
* @example
|
|
35232
|
+
* model = model && model.destroy();
|
|
35233
|
+
*/
|
|
35234
|
+
destroy(): void;
|
|
35235
|
+
/**
|
|
35236
|
+
* <p>
|
|
35237
|
+
Creates a model from a glTF asset. When the model is ready to render, i.e., when the external binary, image,
|
|
35238
|
+
and shader files are downloaded and the WebGL resources are created, the {@link Model#readyPromise} is resolved.
|
|
35239
|
+
</p>
|
|
35240
|
+
<p>
|
|
35241
|
+
The model can be a traditional glTF asset with a .gltf extension or a Binary glTF using the .glb extension.
|
|
35242
|
+
* @param options - Object with the following properties:
|
|
35243
|
+
* @param options.gltf - A Resource/URL to a glTF/glb file, a binary glTF buffer, or a JSON object containing the glTF contents
|
|
35244
|
+
* @param [options.basePath = ''] - The base path that paths in the glTF JSON are relative to.
|
|
35245
|
+
* @param [options.modelMatrix = Matrix4.IDENTITY] - The 4x4 transformation matrix that transforms the model from model to world coordinates.
|
|
35246
|
+
* @param [options.incrementallyLoadTextures = true] - Determine if textures may continue to stream in after the model is loaded.
|
|
35247
|
+
* @param [options.releaseGltfJson = false] - When true, the glTF JSON is released once the glTF is loaded. This is is especially useful for cases like 3D Tiles, where each .gltf model is unique and caching the glTF JSON is not effective.
|
|
35248
|
+
* @param [options.debugShowBoundingVolume = false] - For debugging only. Draws the bounding sphere for each draw command in the model.
|
|
35249
|
+
* @param [options.cull = true] - Whether or not to cull the model using frustum/horizon culling. If the model is part of a 3D Tiles tileset, this property will always be false, since the 3D Tiles culling system is used.
|
|
35250
|
+
* @param [options.opaquePass = Pass.OPAQUE] - The pass to use in the {@link DrawCommand} for the opaque portions of the model.
|
|
35251
|
+
* @param [options.upAxis = Axis.Y] - The up-axis of the glTF model.
|
|
35252
|
+
* @param [options.forwardAxis = Axis.Z] - The forward-axis of the glTF model.
|
|
35253
|
+
* @param [options.allowPicking = true] - When <code>true</code>, each primitive is pickable with {@link Scene#pick}.
|
|
35254
|
+
* @param [options.customShader] - A custom shader. This will add user-defined GLSL code to the vertex and fragment shaders. Using custom shaders with a {@link Cesium3DTileStyle} may lead to undefined behavior.
|
|
35255
|
+
* @param [options.content] - The tile content this model belongs to. This property will be undefined if model is not loaded as part of a tileset.
|
|
35256
|
+
* @param [options.show = true] - Whether or not to render the model.
|
|
35257
|
+
* @param [options.color] - A color that blends with the model's rendered color.
|
|
35258
|
+
* @param [options.colorBlendMode = ColorBlendMode.HIGHLIGHT] - Defines how the color blends with the model.
|
|
35259
|
+
* @param [options.colorBlendAmount = 0.5] - Value used to determine the color strength when the <code>colorBlendMode</code> is <code>MIX</code>. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two.
|
|
35260
|
+
* @param [options.featureIdAttributeIndex = 0] - The index of the feature ID attribute to use for picking features per-instance or per-primitive.
|
|
35261
|
+
* @param [options.featureIdTextureIndex = 0] - The index of the feature ID texture to use for picking features per-primitive.
|
|
35262
|
+
* @returns The newly created model.
|
|
35263
|
+
*/
|
|
35264
|
+
static fromGltf(options: {
|
|
35265
|
+
gltf: string | Resource | Uint8Array | any;
|
|
35266
|
+
basePath?: string | Resource;
|
|
35267
|
+
modelMatrix?: Matrix4;
|
|
35268
|
+
incrementallyLoadTextures?: boolean;
|
|
35269
|
+
releaseGltfJson?: boolean;
|
|
35270
|
+
debugShowBoundingVolume?: boolean;
|
|
35271
|
+
cull?: boolean;
|
|
35272
|
+
opaquePass?: boolean;
|
|
35273
|
+
upAxis?: Axis;
|
|
35274
|
+
forwardAxis?: Axis;
|
|
35275
|
+
allowPicking?: boolean;
|
|
35276
|
+
customShader?: CustomShader;
|
|
35277
|
+
content?: Cesium3DTileContent;
|
|
35278
|
+
show?: boolean;
|
|
35279
|
+
color?: Color;
|
|
35280
|
+
colorBlendMode?: ColorBlendMode;
|
|
35281
|
+
colorBlendAmount?: number;
|
|
35282
|
+
featureIdAttributeIndex?: number;
|
|
35283
|
+
featureIdTextureIndex?: number;
|
|
35284
|
+
}): ModelExperimental;
|
|
35285
|
+
}
|
|
35286
|
+
|
|
35287
|
+
/**
|
|
35288
|
+
* The style to apply the to the features in the model. Cannot be applied if a {@link CustomShader} is also applied.
|
|
35289
|
+
*/
|
|
35290
|
+
export var style: Cesium3DTileStyle;
|
|
35291
|
+
|
|
34889
35292
|
/**
|
|
34890
35293
|
* The 4x4 transformation matrix that transforms the model from model to world coordinates.
|
|
34891
35294
|
When this is the identity matrix, the model is drawn in world coordinates, i.e., Earth's Cartesian WGS84 coordinates.
|
|
@@ -34897,11 +35300,247 @@ m.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(origin);
|
|
|
34897
35300
|
*/
|
|
34898
35301
|
export var modelMatrix: Matrix4;
|
|
34899
35302
|
|
|
35303
|
+
/**
|
|
35304
|
+
* A feature of a {@link ModelExperimental}.
|
|
35305
|
+
<p>
|
|
35306
|
+
Provides access to a feature's properties stored in the model's feature table.
|
|
35307
|
+
</p>
|
|
35308
|
+
<p>
|
|
35309
|
+
Modifications to a <code>ModelFeature</code> object have the lifetime of the model.
|
|
35310
|
+
</p>
|
|
35311
|
+
<p>
|
|
35312
|
+
Do not construct this directly. Access it through picking using {@link Scene#pick}.
|
|
35313
|
+
</p>
|
|
35314
|
+
* @example
|
|
35315
|
+
* // On mouse over, display all the properties for a feature in the console log.
|
|
35316
|
+
handler.setInputAction(function(movement) {
|
|
35317
|
+
var feature = scene.pick(movement.endPosition);
|
|
35318
|
+
if (feature instanceof Cesium.ModelFeature) {
|
|
35319
|
+
console.log(feature);
|
|
35320
|
+
}
|
|
35321
|
+
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
35322
|
+
* @param options - Object with the following properties:
|
|
35323
|
+
* @param options.model - The model the feature belongs to.
|
|
35324
|
+
* @param options.featureId - The unique integral identifier for this feature.
|
|
35325
|
+
*/
|
|
35326
|
+
export class ModelFeature {
|
|
35327
|
+
constructor(options: {
|
|
35328
|
+
model: ModelExperimental;
|
|
35329
|
+
featureId: number;
|
|
35330
|
+
});
|
|
35331
|
+
/**
|
|
35332
|
+
* Gets or sets if the feature will be shown. This is set for all features
|
|
35333
|
+
when a style's show is evaluated.
|
|
35334
|
+
*/
|
|
35335
|
+
show: boolean;
|
|
35336
|
+
/**
|
|
35337
|
+
* Gets or sets the highlight color multiplied with the feature's color. When
|
|
35338
|
+
this is white, the feature's color is not changed. This is set for all features
|
|
35339
|
+
when a style's color is evaluated.
|
|
35340
|
+
*/
|
|
35341
|
+
color: Color;
|
|
35342
|
+
/**
|
|
35343
|
+
* Returns whether the feature contains this property.
|
|
35344
|
+
* @param name - The case-sensitive name of the property.
|
|
35345
|
+
* @returns Whether the feature contains this property.
|
|
35346
|
+
*/
|
|
35347
|
+
hasProperty(name: string): boolean;
|
|
35348
|
+
/**
|
|
35349
|
+
* Returns a copy of the value of the feature's property with the given name.
|
|
35350
|
+
* @example
|
|
35351
|
+
* // Display all the properties for a feature in the console log.
|
|
35352
|
+
var propertyNames = feature.getPropertyNames();
|
|
35353
|
+
var length = propertyNames.length;
|
|
35354
|
+
for (var i = 0; i < length; ++i) {
|
|
35355
|
+
var propertyName = propertyNames[i];
|
|
35356
|
+
console.log(propertyName + ': ' + feature.getProperty(propertyName));
|
|
35357
|
+
}
|
|
35358
|
+
* @param name - The case-sensitive name of the property.
|
|
35359
|
+
* @returns The value of the property or <code>undefined</code> if the feature does not have this property.
|
|
35360
|
+
*/
|
|
35361
|
+
getProperty(name: string): any;
|
|
35362
|
+
/**
|
|
35363
|
+
* Returns a copy of the feature's property with the given name, examining all
|
|
35364
|
+
the metadata from the EXT_mesh_features and legacy EXT_feature_metadata glTF
|
|
35365
|
+
extensions. Metadata is checked against name from most specific to most
|
|
35366
|
+
general and the first match is returned. Metadata is checked in this order:
|
|
35367
|
+
<ol>
|
|
35368
|
+
<li>Feature metadata property by semantic</li>
|
|
35369
|
+
<li>Feature metadata property by property ID</li>
|
|
35370
|
+
</ol>
|
|
35371
|
+
<p>
|
|
35372
|
+
See the {@link https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features|EXT_mesh_features Extension} as well as the
|
|
35373
|
+
previous {@link https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata|EXT_feature_metadata Extension} for glTF.
|
|
35374
|
+
</p>
|
|
35375
|
+
* @param name - The semantic or property ID of the feature. Semantics are checked before property IDs in each granularity of metadata.
|
|
35376
|
+
* @returns The value of the property or <code>undefined</code> if the feature does not have this property.
|
|
35377
|
+
*/
|
|
35378
|
+
getPropertyInherited(name: string): any;
|
|
35379
|
+
/**
|
|
35380
|
+
* Returns an array of property names for the feature.
|
|
35381
|
+
* @param [results] - An array into which to store the results.
|
|
35382
|
+
* @returns The names of the feature's properties.
|
|
35383
|
+
*/
|
|
35384
|
+
getPropertyNames(results?: string[]): string[];
|
|
35385
|
+
/**
|
|
35386
|
+
* Sets the value of the feature's property with the given name.
|
|
35387
|
+
* @example
|
|
35388
|
+
* var height = feature.getProperty('Height'); // e.g., the height of a building
|
|
35389
|
+
* @example
|
|
35390
|
+
* var name = 'clicked';
|
|
35391
|
+
if (feature.getProperty(name)) {
|
|
35392
|
+
console.log('already clicked');
|
|
35393
|
+
} else {
|
|
35394
|
+
feature.setProperty(name, true);
|
|
35395
|
+
console.log('first click');
|
|
35396
|
+
}
|
|
35397
|
+
* @param name - The case-sensitive name of the property.
|
|
35398
|
+
* @param value - The value of the property that will be copied.
|
|
35399
|
+
* @returns <code>true</code> if the property was set, <code>false</code> otherwise.
|
|
35400
|
+
*/
|
|
35401
|
+
setProperty(name: string, value: any): boolean;
|
|
35402
|
+
}
|
|
35403
|
+
|
|
34900
35404
|
/**
|
|
34901
35405
|
* The bounding sphere that contains all the vertices in this primitive.
|
|
34902
35406
|
*/
|
|
34903
35407
|
export var boundingSphere: BoundingSphere;
|
|
34904
35408
|
|
|
35409
|
+
/**
|
|
35410
|
+
* A simple struct that serves as a value of a <code>sampler2D</code>-valued
|
|
35411
|
+
uniform. This is used with {@link CustomShader} and {@link TextureManager}
|
|
35412
|
+
* @param options - An object with the following properties:
|
|
35413
|
+
* @param [options.typedArray] - A typed array storing the contents of a texture. Values are stored in row-major order. Since WebGL uses a y-up convention for textures, rows are listed from bottom to top.
|
|
35414
|
+
* @param [options.width] - The width of the image. Required when options.typedArray is present
|
|
35415
|
+
* @param [options.height] - The height of the image. Required when options.typedArray is present.
|
|
35416
|
+
* @param [options.url] - A URL string or resource pointing to a texture image.
|
|
35417
|
+
* @param [options.repeat = true] - When defined, the texture sampler will be set to wrap in both directions
|
|
35418
|
+
* @param [options.pixelFormat = PixelFormat.RGBA] - When options.typedArray is defined, this is used to determine the pixel format of the texture
|
|
35419
|
+
* @param [options.pixelDatatype = PixelDatatype.UNSIGNED_BYTE] - When options.typedArray is defined, this is the data type of pixel values in the typed array.
|
|
35420
|
+
* @param [textureMinificationFilter = TextureMinificationFilter.LINEAR] - The minification filter of the texture sampler.
|
|
35421
|
+
* @param [textureMagnificationFilter = TextureMagnificationFilter.LINEAR] - The magnification filter of the texture sampler.
|
|
35422
|
+
* @param [options.maximumAnisotropy = 1.0] - The maximum anisotropy of the texture sampler
|
|
35423
|
+
*/
|
|
35424
|
+
export class TextureUniform {
|
|
35425
|
+
constructor(options: {
|
|
35426
|
+
typedArray?: Uint8Array;
|
|
35427
|
+
width?: number;
|
|
35428
|
+
height?: number;
|
|
35429
|
+
url?: string | Resource;
|
|
35430
|
+
repeat?: boolean;
|
|
35431
|
+
pixelFormat?: PixelFormat;
|
|
35432
|
+
pixelDatatype?: PixelDatatype;
|
|
35433
|
+
maximumAnisotropy?: number;
|
|
35434
|
+
}, textureMinificationFilter?: TextureMinificationFilter, textureMagnificationFilter?: TextureMagnificationFilter);
|
|
35435
|
+
}
|
|
35436
|
+
|
|
35437
|
+
/**
|
|
35438
|
+
* An enum of the basic GLSL uniform types. These can be used with
|
|
35439
|
+
{@link CustomShader} to declare user-defined uniforms.
|
|
35440
|
+
*/
|
|
35441
|
+
export enum UniformType {
|
|
35442
|
+
/**
|
|
35443
|
+
* A single floating point value.
|
|
35444
|
+
*/
|
|
35445
|
+
FLOAT = "float",
|
|
35446
|
+
/**
|
|
35447
|
+
* A vector of 2 floating point values.
|
|
35448
|
+
*/
|
|
35449
|
+
VEC2 = "vec2",
|
|
35450
|
+
/**
|
|
35451
|
+
* A vector of 3 floating point values.
|
|
35452
|
+
*/
|
|
35453
|
+
VEC3 = "vec3",
|
|
35454
|
+
/**
|
|
35455
|
+
* A vector of 4 floating point values.
|
|
35456
|
+
*/
|
|
35457
|
+
VEC4 = "vec4",
|
|
35458
|
+
/**
|
|
35459
|
+
* A single integer value
|
|
35460
|
+
*/
|
|
35461
|
+
INT = "int",
|
|
35462
|
+
/**
|
|
35463
|
+
* A vector of 2 integer values.
|
|
35464
|
+
*/
|
|
35465
|
+
INT_VEC2 = "ivec2",
|
|
35466
|
+
/**
|
|
35467
|
+
* A vector of 3 integer values.
|
|
35468
|
+
*/
|
|
35469
|
+
INT_VEC3 = "ivec3",
|
|
35470
|
+
/**
|
|
35471
|
+
* A vector of 4 integer values.
|
|
35472
|
+
*/
|
|
35473
|
+
INT_VEC4 = "ivec4",
|
|
35474
|
+
/**
|
|
35475
|
+
* A single boolean value.
|
|
35476
|
+
*/
|
|
35477
|
+
BOOL = "bool",
|
|
35478
|
+
/**
|
|
35479
|
+
* A vector of 2 boolean values.
|
|
35480
|
+
*/
|
|
35481
|
+
BOOL_VEC2 = "bvec2",
|
|
35482
|
+
/**
|
|
35483
|
+
* A vector of 3 boolean values.
|
|
35484
|
+
*/
|
|
35485
|
+
BOOL_VEC3 = "bvec3",
|
|
35486
|
+
/**
|
|
35487
|
+
* A vector of 4 boolean values.
|
|
35488
|
+
*/
|
|
35489
|
+
BOOL_VEC4 = "bvec4",
|
|
35490
|
+
/**
|
|
35491
|
+
* A 2x2 matrix of floating point values.
|
|
35492
|
+
*/
|
|
35493
|
+
MAT2 = "mat2",
|
|
35494
|
+
/**
|
|
35495
|
+
* A 3x3 matrix of floating point values.
|
|
35496
|
+
*/
|
|
35497
|
+
MAT3 = "mat2",
|
|
35498
|
+
/**
|
|
35499
|
+
* A 3x3 matrix of floating point values.
|
|
35500
|
+
*/
|
|
35501
|
+
MAT4 = "mat4",
|
|
35502
|
+
/**
|
|
35503
|
+
* A 2D sampled texture.
|
|
35504
|
+
*/
|
|
35505
|
+
SAMPLER_2D = "sampler2D",
|
|
35506
|
+
SAMPLER_CUBE = "samplerCube"
|
|
35507
|
+
}
|
|
35508
|
+
|
|
35509
|
+
/**
|
|
35510
|
+
* An enum for the GLSL varying types. These can be used for declaring varyings
|
|
35511
|
+
in {@link CustomShader}
|
|
35512
|
+
*/
|
|
35513
|
+
export enum VaryingType {
|
|
35514
|
+
/**
|
|
35515
|
+
* A single floating point value.
|
|
35516
|
+
*/
|
|
35517
|
+
FLOAT = "float",
|
|
35518
|
+
/**
|
|
35519
|
+
* A vector of 2 floating point values.
|
|
35520
|
+
*/
|
|
35521
|
+
VEC2 = "vec2",
|
|
35522
|
+
/**
|
|
35523
|
+
* A vector of 3 floating point values.
|
|
35524
|
+
*/
|
|
35525
|
+
VEC3 = "vec3",
|
|
35526
|
+
/**
|
|
35527
|
+
* A vector of 4 floating point values.
|
|
35528
|
+
*/
|
|
35529
|
+
VEC4 = "vec4",
|
|
35530
|
+
/**
|
|
35531
|
+
* A 2x2 matrix of floating point values.
|
|
35532
|
+
*/
|
|
35533
|
+
MAT2 = "mat2",
|
|
35534
|
+
/**
|
|
35535
|
+
* A 3x3 matrix of floating point values.
|
|
35536
|
+
*/
|
|
35537
|
+
MAT3 = "mat2",
|
|
35538
|
+
/**
|
|
35539
|
+
* A 3x3 matrix of floating point values.
|
|
35540
|
+
*/
|
|
35541
|
+
MAT4 = "mat4"
|
|
35542
|
+
}
|
|
35543
|
+
|
|
34905
35544
|
/**
|
|
34906
35545
|
* A model's material with modifiable parameters. A glTF material
|
|
34907
35546
|
contains parameters defined by the material's technique with values
|
|
@@ -43391,6 +44030,14 @@ declare module "cesium/Source/Widgets/Command" { import { Command } from 'cesium
|
|
|
43391
44030
|
declare module "cesium/Source/Widgets/createCommand" { import { createCommand } from 'cesium'; export default createCommand; }
|
|
43392
44031
|
declare module "cesium/Source/Widgets/SvgPathBindingHandler" { import { SvgPathBindingHandler } from 'cesium'; export default SvgPathBindingHandler; }
|
|
43393
44032
|
declare module "cesium/Source/Widgets/ToggleButtonViewModel" { import { ToggleButtonViewModel } from 'cesium'; export default ToggleButtonViewModel; }
|
|
44033
|
+
declare module "cesium/Source/Scene/ModelExperimental/CustomShader" { import { CustomShader } from 'cesium'; export default CustomShader; }
|
|
44034
|
+
declare module "cesium/Source/Scene/ModelExperimental/CustomShaderMode" { import { CustomShaderMode } from 'cesium'; export default CustomShaderMode; }
|
|
44035
|
+
declare module "cesium/Source/Scene/ModelExperimental/LightingModel" { import { LightingModel } from 'cesium'; export default LightingModel; }
|
|
44036
|
+
declare module "cesium/Source/Scene/ModelExperimental/ModelExperimental" { import { ModelExperimental } from 'cesium'; export default ModelExperimental; }
|
|
44037
|
+
declare module "cesium/Source/Scene/ModelExperimental/ModelFeature" { import { ModelFeature } from 'cesium'; export default ModelFeature; }
|
|
44038
|
+
declare module "cesium/Source/Scene/ModelExperimental/TextureUniform" { import { TextureUniform } from 'cesium'; export default TextureUniform; }
|
|
44039
|
+
declare module "cesium/Source/Scene/ModelExperimental/UniformType" { import { UniformType } from 'cesium'; export default UniformType; }
|
|
44040
|
+
declare module "cesium/Source/Scene/ModelExperimental/VaryingType" { import { VaryingType } from 'cesium'; export default VaryingType; }
|
|
43394
44041
|
declare module "cesium/Source/Widgets/Animation/Animation" { import { Animation } from 'cesium'; export default Animation; }
|
|
43395
44042
|
declare module "cesium/Source/Widgets/Animation/AnimationViewModel" { import { AnimationViewModel } from 'cesium'; export default AnimationViewModel; }
|
|
43396
44043
|
declare module "cesium/Source/Widgets/BaseLayerPicker/BaseLayerPicker" { import { BaseLayerPicker } from 'cesium'; export default BaseLayerPicker; }
|