@mesh3d/cesium-vectortile-gl 0.1.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/LICENSE.md +21 -0
- package/README.md +120 -0
- package/Source/Cesium.d.ts +2692 -0
- package/Source/VectorTileLOD.js +494 -0
- package/Source/VectorTileRenderList.js +65 -0
- package/Source/VectorTileset.js +309 -0
- package/Source/layers/BackgroundRenderLayer.js +82 -0
- package/Source/layers/FillRenderLayer.js +18 -0
- package/Source/layers/IRenderLayer.js +128 -0
- package/Source/layers/LineRenderLayer.js +94 -0
- package/Source/layers/SymbolRenderLayer.js +31 -0
- package/Source/layers/index.js +16 -0
- package/Source/layers/registerRenderLayer.js +24 -0
- package/Source/layers/visualizers/FillLayerVisualizer.js +420 -0
- package/Source/layers/visualizers/ILayerVisualizer.js +73 -0
- package/Source/layers/visualizers/LineLayerVisualizer.js +565 -0
- package/Source/layers/visualizers/SymbolLayerVisualizer.js +179 -0
- package/Source/sources/GeoJSONSource.js +46 -0
- package/Source/sources/ISource.js +39 -0
- package/Source/sources/VectorSource.js +45 -0
- package/Source/sources/granularitySettings.js +20 -0
- package/Source/sources/index.js +11 -0
- package/Source/sources/registerSource.js +19 -0
- package/Source/style/StyleLayer.js +43 -0
- package/Source/style/StyleLayerProperties.js +43 -0
- package/Source/style/index.js +2 -0
- package/dist/cvt-gl.js +10642 -0
- package/dist/cvt-gl.js.map +1 -0
- package/dist/cvt-gl.min.js +135 -0
- package/dist/cvt-gl.min.js.map +1 -0
- package/index.js +6 -0
- package/logo.svg +47 -0
- package/package.json +36 -0
|
@@ -0,0 +1,2692 @@
|
|
|
1
|
+
export * from 'cesium'
|
|
2
|
+
|
|
3
|
+
//这里补充一些Cesium官方d.ts没有包含的被标为私有的API说明,辅助代码提示。
|
|
4
|
+
//注意:在vscode中保持打开这个文件,代码提示才会出现这些私有API的提示
|
|
5
|
+
//renderer-private:start
|
|
6
|
+
|
|
7
|
+
export interface IPrimitive {
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {FrameState}frameState
|
|
11
|
+
*/
|
|
12
|
+
update(frameState: FrameState): void
|
|
13
|
+
|
|
14
|
+
destroy(): any
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* State information about the current frame. An instance of this class
|
|
19
|
+
* is provided to update functions.
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
export class FrameState {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* State information about the current frame. An instance of this class
|
|
26
|
+
* is provided to update functions.
|
|
27
|
+
*
|
|
28
|
+
* @param {Context} context The rendering context
|
|
29
|
+
* @param {CreditDisplay} creditDisplay Handles adding and removing credits from an HTML element
|
|
30
|
+
* @param {JobScheduler} jobScheduler The job scheduler
|
|
31
|
+
*
|
|
32
|
+
* @alias FrameState
|
|
33
|
+
* @constructor
|
|
34
|
+
*
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
constructor(context: Context, creditDisplay: CreditDisplay, jobScheduler: JobScheduler)
|
|
38
|
+
/**
|
|
39
|
+
* The rendering context.
|
|
40
|
+
*
|
|
41
|
+
* @type {Context}
|
|
42
|
+
*/
|
|
43
|
+
context: Context
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* An array of rendering commands.
|
|
47
|
+
*
|
|
48
|
+
* @type {DrawCommand[]}
|
|
49
|
+
*/
|
|
50
|
+
commandList: DrawCommand[];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* An array of shadow maps.
|
|
54
|
+
* @type {ShadowMap[]}
|
|
55
|
+
*/
|
|
56
|
+
shadowMaps: ShadowMap[];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The BRDF look up texture generator used for image-based lighting for PBR models
|
|
60
|
+
* @type {BrdfLutGenerator}
|
|
61
|
+
*/
|
|
62
|
+
brdfLutGenerator: BrdfLutGenerator;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The environment map used for image-based lighting for PBR models
|
|
66
|
+
* @type {CubeMap}
|
|
67
|
+
*/
|
|
68
|
+
environmentMap: CubeMap;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The spherical harmonic coefficients used for image-based lighting for PBR models.
|
|
72
|
+
* @type {Cartesian3[]}
|
|
73
|
+
*/
|
|
74
|
+
sphericalHarmonicCoefficients: Cartesian3[];
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The specular environment atlas used for image-based lighting for PBR models.
|
|
78
|
+
* @type {Texture}
|
|
79
|
+
*/
|
|
80
|
+
specularEnvironmentMaps: Texture;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The maximum level-of-detail of the specular environment atlas used for image-based lighting for PBR models.
|
|
84
|
+
* @type {Number}
|
|
85
|
+
*/
|
|
86
|
+
specularEnvironmentMapsMaximumLOD: number;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The current mode of the scene.
|
|
90
|
+
*
|
|
91
|
+
* @type {SceneMode}
|
|
92
|
+
* @default {@link SceneMode.SCENE3D}
|
|
93
|
+
*/
|
|
94
|
+
mode: SceneMode;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The current morph transition time between 2D/Columbus View and 3D,
|
|
98
|
+
* with 0.0 being 2D or Columbus View and 1.0 being 3D.
|
|
99
|
+
*
|
|
100
|
+
* @type {Number}
|
|
101
|
+
*/
|
|
102
|
+
morphTime: Number//SceneMode.getMorphTime(SceneMode.SCENE3D);
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The current frame number.
|
|
106
|
+
*
|
|
107
|
+
* @type {Number}
|
|
108
|
+
* @default 0
|
|
109
|
+
*/
|
|
110
|
+
frameNumber: number;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* <code>true</code> if a new frame has been issued and the frame number has been updated.
|
|
114
|
+
*
|
|
115
|
+
* @type {Boolean}
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
newFrame: boolean;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The scene's current time.
|
|
122
|
+
*
|
|
123
|
+
* @type {JulianDate}
|
|
124
|
+
* @default undefined
|
|
125
|
+
*/
|
|
126
|
+
time: JulianDate;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The job scheduler.
|
|
130
|
+
*
|
|
131
|
+
* @type {JobScheduler}
|
|
132
|
+
*/
|
|
133
|
+
jobScheduler: JobScheduler;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The map projection to use in 2D and Columbus View modes.
|
|
137
|
+
*
|
|
138
|
+
* @type {MapProjection}
|
|
139
|
+
* @default undefined
|
|
140
|
+
*/
|
|
141
|
+
mapProjection: MapProjection;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The current camera.
|
|
145
|
+
*
|
|
146
|
+
* @type {Camera}
|
|
147
|
+
* @default undefined
|
|
148
|
+
*/
|
|
149
|
+
camera: Camera;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Whether the camera is underground.
|
|
153
|
+
*
|
|
154
|
+
* @type {Boolean}
|
|
155
|
+
* @default false
|
|
156
|
+
*/
|
|
157
|
+
cameraUnderground: boolean;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The {@link GlobeTranslucencyState} object used by the scene.
|
|
161
|
+
*
|
|
162
|
+
* @type {GlobeTranslucencyState}
|
|
163
|
+
* @default undefined
|
|
164
|
+
*/
|
|
165
|
+
globeTranslucencyState: GlobeTranslucencyState;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The culling volume.
|
|
169
|
+
*
|
|
170
|
+
* @type {CullingVolume}
|
|
171
|
+
* @default undefined
|
|
172
|
+
*/
|
|
173
|
+
cullingVolume: CullingVolume;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The current occluder.
|
|
177
|
+
*
|
|
178
|
+
* @type {Occluder}
|
|
179
|
+
* @default undefined
|
|
180
|
+
*/
|
|
181
|
+
occluder: Occluder;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The maximum screen-space error used to drive level-of-detail refinement. Higher
|
|
185
|
+
* values will provide better performance but lower visual quality.
|
|
186
|
+
*
|
|
187
|
+
* @type {Number}
|
|
188
|
+
* @default 2
|
|
189
|
+
*/
|
|
190
|
+
maximumScreenSpaceError: number;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Ratio between a pixel and a density-independent pixel. Provides a standard unit of
|
|
194
|
+
* measure for real pixel measurements appropriate to a particular device.
|
|
195
|
+
*
|
|
196
|
+
* @type {Number}
|
|
197
|
+
* @default 1.0
|
|
198
|
+
*/
|
|
199
|
+
pixelRatio: number;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @typedef FrameState.Passes
|
|
203
|
+
* @type {Object}
|
|
204
|
+
* @property {Boolean} render <code>true</code> if the primitive should update for a render pass, <code>false</code> otherwise.
|
|
205
|
+
* @property {Boolean} pick <code>true</code> if the primitive should update for a picking pass, <code>false</code> otherwise.
|
|
206
|
+
* @property {Boolean} depth <code>true</code> if the primitive should update for a depth only pass, <code>false</code> otherwise.
|
|
207
|
+
* @property {Boolean} postProcess <code>true</code> if the primitive should update for a per-feature post-process pass, <code>false</code> otherwise.
|
|
208
|
+
* @property {Boolean} offscreen <code>true</code> if the primitive should update for an offscreen pass, <code>false</code> otherwise.
|
|
209
|
+
*/
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @type {FrameState.Passes}
|
|
213
|
+
*/
|
|
214
|
+
passes: {
|
|
215
|
+
/**
|
|
216
|
+
* @default false
|
|
217
|
+
*/
|
|
218
|
+
render: false,
|
|
219
|
+
/**
|
|
220
|
+
* @default false
|
|
221
|
+
*/
|
|
222
|
+
pick: false,
|
|
223
|
+
/**
|
|
224
|
+
* @default false
|
|
225
|
+
*/
|
|
226
|
+
depth: false,
|
|
227
|
+
/**
|
|
228
|
+
* @default false
|
|
229
|
+
*/
|
|
230
|
+
postProcess: false,
|
|
231
|
+
/**
|
|
232
|
+
* @default false
|
|
233
|
+
*/
|
|
234
|
+
offscreen: false,
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The credit display.
|
|
239
|
+
*
|
|
240
|
+
* @type {CreditDisplay}
|
|
241
|
+
*/
|
|
242
|
+
creditDisplay: reditDisplay;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* An array of functions to be called at the end of the frame. This array
|
|
246
|
+
* will be cleared after each frame.
|
|
247
|
+
* <p>
|
|
248
|
+
* This allows queueing up events in <code>update</code> functions and
|
|
249
|
+
* firing them at a time when the subscribers are free to change the
|
|
250
|
+
* scene state, e.g., manipulate the camera, instead of firing events
|
|
251
|
+
* directly in <code>update</code> functions.
|
|
252
|
+
* </p>
|
|
253
|
+
*
|
|
254
|
+
* @type {(()=>void)[]}
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* frameState.afterRender.push(function() {
|
|
258
|
+
* // take some action, raise an event, etc.
|
|
259
|
+
* });
|
|
260
|
+
*/
|
|
261
|
+
afterRender: (() => void)[]
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Gets whether or not to optimized for 3D only.
|
|
265
|
+
*
|
|
266
|
+
* @type {Boolean}
|
|
267
|
+
* @default false
|
|
268
|
+
*/
|
|
269
|
+
scene3DOnly: boolean;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @typedef FrameState.Fog
|
|
273
|
+
* @type {Object}
|
|
274
|
+
* @property {Boolean} enabled <code>true</code> if fog is enabled, <code>false</code> otherwise.
|
|
275
|
+
* @property {Number} density A positive number used to mix the color and fog color based on camera distance.
|
|
276
|
+
* @property {Number} sse A scalar used to modify the screen space error of geometry partially in fog.
|
|
277
|
+
* @property {Number} minimumBrightness The minimum brightness of terrain with fog applied.
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @type {FrameState.Fog}
|
|
282
|
+
*/
|
|
283
|
+
|
|
284
|
+
fog: {
|
|
285
|
+
/**
|
|
286
|
+
* @default false
|
|
287
|
+
*/
|
|
288
|
+
enabled: false,
|
|
289
|
+
density: undefined,
|
|
290
|
+
sse: undefined,
|
|
291
|
+
minimumBrightness: undefined,
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* A scalar used to exaggerate the terrain.
|
|
296
|
+
* @type {Number}
|
|
297
|
+
* @default 1.0
|
|
298
|
+
*/
|
|
299
|
+
terrainExaggeration: number;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* @typedef FrameState.ShadowState
|
|
303
|
+
* @type {Object}
|
|
304
|
+
* @property {Boolean} shadowsEnabled Whether there are any active shadow maps this frame.
|
|
305
|
+
* @property {Boolean} lightShadowsEnabled Whether there are any active shadow maps that originate from light sources. Does not include shadow maps that are used for analytical purposes.
|
|
306
|
+
* @property {ShadowMap[]} shadowMaps All shadow maps that are enabled this frame.
|
|
307
|
+
* @property {ShadowMap[]} lightShadowMaps Shadow maps that originate from light sources. Does not include shadow maps that are used for analytical purposes. Only these shadow maps will be used to generate receive shadows shaders.
|
|
308
|
+
* @property {Number} nearPlane The near plane of the scene's frustum commands. Used for fitting cascaded shadow maps.
|
|
309
|
+
* @property {Number} farPlane The far plane of the scene's frustum commands. Used for fitting cascaded shadow maps.
|
|
310
|
+
* @property {Number} closestObjectSize The size of the bounding volume that is closest to the camera. This is used to place more shadow detail near the object.
|
|
311
|
+
* @property {Number} lastDirtyTime The time when a shadow map was last dirty
|
|
312
|
+
* @property {Boolean} outOfView Whether the shadows maps are out of view this frame
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* @type {FrameState.ShadowState}
|
|
317
|
+
*/
|
|
318
|
+
|
|
319
|
+
shadowState: {
|
|
320
|
+
/**
|
|
321
|
+
* @default true
|
|
322
|
+
*/
|
|
323
|
+
shadowsEnabled: true,
|
|
324
|
+
shadowMaps: [],
|
|
325
|
+
lightShadowMaps: [],
|
|
326
|
+
/**
|
|
327
|
+
* @default 1.0
|
|
328
|
+
*/
|
|
329
|
+
nearPlane: 1.0,
|
|
330
|
+
/**
|
|
331
|
+
* @default 5000.0
|
|
332
|
+
*/
|
|
333
|
+
farPlane: 5000.0,
|
|
334
|
+
/**
|
|
335
|
+
* @default 1000.0
|
|
336
|
+
*/
|
|
337
|
+
closestObjectSize: 1000.0,
|
|
338
|
+
/**
|
|
339
|
+
* @default 0
|
|
340
|
+
*/
|
|
341
|
+
lastDirtyTime: 0,
|
|
342
|
+
/**
|
|
343
|
+
* @default true
|
|
344
|
+
*/
|
|
345
|
+
outOfView: true,
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* The position of the splitter to use when rendering imagery layers on either side of a splitter.
|
|
350
|
+
* This value should be between 0.0 and 1.0 with 0 being the far left of the viewport and 1 being the far right of the viewport.
|
|
351
|
+
* @type {Number}
|
|
352
|
+
* @default 0.0
|
|
353
|
+
*/
|
|
354
|
+
imagerySplitPosition: number;
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Distances to the near and far planes of the camera frustums
|
|
358
|
+
* @type {Number[]}
|
|
359
|
+
* @default []
|
|
360
|
+
*/
|
|
361
|
+
frustumSplits: number[];
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* The current scene background color
|
|
365
|
+
*
|
|
366
|
+
* @type {Color}
|
|
367
|
+
*/
|
|
368
|
+
backgroundColor: Color;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* The light used to shade the scene.
|
|
372
|
+
*
|
|
373
|
+
* @type {Light}
|
|
374
|
+
*/
|
|
375
|
+
light: Light;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* The distance from the camera at which to disable the depth test of billboards, labels and points
|
|
379
|
+
* to, for example, prevent clipping against terrain. When set to zero, the depth test should always
|
|
380
|
+
* be applied. When less than zero, the depth test should never be applied.
|
|
381
|
+
* @type {Number}
|
|
382
|
+
*/
|
|
383
|
+
minimumDisableDepthTestDistance: number;
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* When <code>false</code>, 3D Tiles will render normally. When <code>true</code>, classified 3D Tile geometry will render normally and
|
|
387
|
+
* unclassified 3D Tile geometry will render with the color multiplied with {@link FrameState#invertClassificationColor}.
|
|
388
|
+
* @type {Boolean}
|
|
389
|
+
* @default false
|
|
390
|
+
*/
|
|
391
|
+
invertClassification: boolean;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* The highlight color of unclassified 3D Tile geometry when {@link FrameState#invertClassification} is <code>true</code>.
|
|
395
|
+
* @type {Color}
|
|
396
|
+
*/
|
|
397
|
+
invertClassificationColor: Color;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Whether or not the scene uses a logarithmic depth buffer.
|
|
401
|
+
*
|
|
402
|
+
* @type {Boolean}
|
|
403
|
+
* @default false
|
|
404
|
+
*/
|
|
405
|
+
useLogDepth: boolean;
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Additional state used to update 3D Tilesets.
|
|
409
|
+
*
|
|
410
|
+
* @type {Cesium3DTilePassState}
|
|
411
|
+
*/
|
|
412
|
+
tilesetPassState: Cesium3DTilePassState;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* The minimum terrain height out of all rendered terrain tiles. Used to improve culling for objects underneath the ellipsoid but above terrain.
|
|
416
|
+
*
|
|
417
|
+
* @type {Number}
|
|
418
|
+
* @default 0.0
|
|
419
|
+
*/
|
|
420
|
+
minimumTerrainHeight: number;
|
|
421
|
+
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* @private
|
|
426
|
+
*/
|
|
427
|
+
export enum BufferUsage {
|
|
428
|
+
// STREAM_DRAW = WebGLConstants.STREAM_DRAW,
|
|
429
|
+
// STATIC_DRAW = WebGLConstants.STATIC_DRAW,
|
|
430
|
+
// DYNAMIC_DRAW = WebGLConstants.DYNAMIC_DRAW
|
|
431
|
+
STREAM_DRAW = 35040,
|
|
432
|
+
STATIC_DRAW = 35044,
|
|
433
|
+
DYNAMIC_DRAW = 35048
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* @private
|
|
438
|
+
*/
|
|
439
|
+
export class Buffer {
|
|
440
|
+
constructor(options: {
|
|
441
|
+
context: Context
|
|
442
|
+
bufferTarget: number
|
|
443
|
+
typedArray: ArrayBufferView
|
|
444
|
+
sizeInBytes: number
|
|
445
|
+
usage: BufferUsage
|
|
446
|
+
|
|
447
|
+
})
|
|
448
|
+
|
|
449
|
+
_gl: WebGL2RenderingContext | WebGLRenderingContext
|
|
450
|
+
_webgl2: boolean
|
|
451
|
+
_bufferTarget: number
|
|
452
|
+
_sizeInBytes: number
|
|
453
|
+
_usage: BufferUsage
|
|
454
|
+
_buffer: WebGLBuffer
|
|
455
|
+
vertexArrayDestroyable: boolean
|
|
456
|
+
/**
|
|
457
|
+
* @readonly
|
|
458
|
+
*/
|
|
459
|
+
sizeInBytes: number
|
|
460
|
+
/**
|
|
461
|
+
* @readonly
|
|
462
|
+
*/
|
|
463
|
+
usage: BufferUsage
|
|
464
|
+
_getBuffer: () => WebGLBuffer
|
|
465
|
+
copyFromArrayView: (arrayView: ArrayBufferView, offsetInBytes: number) => void
|
|
466
|
+
copyFromBuffer: (
|
|
467
|
+
readBuffer: Buffer,
|
|
468
|
+
readOffset: number,
|
|
469
|
+
writeOffset: number,
|
|
470
|
+
sizeInBytes: number
|
|
471
|
+
) => void
|
|
472
|
+
getBufferData: (
|
|
473
|
+
arrayView: ArrayBufferView,
|
|
474
|
+
sourceOffset: number,
|
|
475
|
+
destinationOffset: number,
|
|
476
|
+
length: number
|
|
477
|
+
) => void
|
|
478
|
+
|
|
479
|
+
isDestroyed: () => boolean
|
|
480
|
+
destroy: () => any
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Creates a vertex buffer, which contains untyped vertex data in GPU-controlled memory.
|
|
484
|
+
* <br /><br />
|
|
485
|
+
* A vertex array defines the actual makeup of a vertex, e.g., positions, normals, texture coordinates,
|
|
486
|
+
* etc., by interpreting the raw data in one or more vertex buffers.
|
|
487
|
+
*
|
|
488
|
+
* @param {Object} options An object containing the following properties:
|
|
489
|
+
* @param {Context} options.context The context in which to create the buffer
|
|
490
|
+
* @param {ArrayBufferView} [options.typedArray] A typed array containing the data to copy to the buffer.
|
|
491
|
+
* @param {Number} [options.sizeInBytes] A <code>Number</code> defining the size of the buffer in bytes. Required if options.typedArray is not given.
|
|
492
|
+
* @param {BufferUsage} options.usage Specifies the expected usage pattern of the buffer. On some GL implementations, this can significantly affect performance. See {@link BufferUsage}.
|
|
493
|
+
* @returns {VertexBuffer} The vertex buffer, ready to be attached to a vertex array.
|
|
494
|
+
*
|
|
495
|
+
* @exception {DeveloperError} Must specify either <options.typedArray> or <options.sizeInBytes>, but not both.
|
|
496
|
+
* @exception {DeveloperError} The buffer size must be greater than zero.
|
|
497
|
+
* @exception {DeveloperError} Invalid <code>usage</code>.
|
|
498
|
+
*
|
|
499
|
+
*
|
|
500
|
+
* @example
|
|
501
|
+
* // Example 1. Create a dynamic vertex buffer 16 bytes in size.
|
|
502
|
+
* var buffer = Buffer.createVertexBuffer({
|
|
503
|
+
* context : context,
|
|
504
|
+
* sizeInBytes : 16,
|
|
505
|
+
* usage : BufferUsage.DYNAMIC_DRAW
|
|
506
|
+
* });
|
|
507
|
+
*
|
|
508
|
+
* @example
|
|
509
|
+
* // Example 2. Create a dynamic vertex buffer from three floating-point values.
|
|
510
|
+
* // The data copied to the vertex buffer is considered raw bytes until it is
|
|
511
|
+
* // interpreted as vertices using a vertex array.
|
|
512
|
+
* var positionBuffer = buffer.createVertexBuffer({
|
|
513
|
+
* context : context,
|
|
514
|
+
* typedArray : new Float32Array([0, 0, 0]),
|
|
515
|
+
* usage : BufferUsage.STATIC_DRAW
|
|
516
|
+
* });
|
|
517
|
+
*
|
|
518
|
+
* @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGenBuffer.xml|glGenBuffer}
|
|
519
|
+
* @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glBindBuffer.xml|glBindBuffer} with <code>ARRAY_BUFFER</code>
|
|
520
|
+
* @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glBufferData.xml|glBufferData} with <code>ARRAY_BUFFER</code>
|
|
521
|
+
*/
|
|
522
|
+
static createVertexBuffer: (options: {
|
|
523
|
+
context: Context
|
|
524
|
+
typedArray?: ArrayBufferView
|
|
525
|
+
usage: BufferUsage
|
|
526
|
+
sizeInBytes?: number
|
|
527
|
+
}) => Buffer
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Creates an index buffer, which contains typed indices in GPU-controlled memory.
|
|
531
|
+
* <br /><br />
|
|
532
|
+
* An index buffer can be attached to a vertex array to select vertices for rendering.
|
|
533
|
+
* <code>Context.draw</code> can render using the entire index buffer or a subset
|
|
534
|
+
* of the index buffer defined by an offset and count.
|
|
535
|
+
*
|
|
536
|
+
* @param {Object} options An object containing the following properties:
|
|
537
|
+
* @param {Context} options.context The context in which to create the buffer
|
|
538
|
+
* @param {ArrayBufferView} [options.typedArray] A typed array containing the data to copy to the buffer.
|
|
539
|
+
* @param {Number} [options.sizeInBytes] A <code>Number</code> defining the size of the buffer in bytes. Required if options.typedArray is not given.
|
|
540
|
+
* @param {BufferUsage} options.usage Specifies the expected usage pattern of the buffer. On some GL implementations, this can significantly affect performance. See {@link BufferUsage}.
|
|
541
|
+
* @param {IndexDatatype} options.indexDatatype The datatype of indices in the buffer.
|
|
542
|
+
* @returns {IndexBuffer} The index buffer, ready to be attached to a vertex array.
|
|
543
|
+
*
|
|
544
|
+
* @exception {DeveloperError} Must specify either <options.typedArray> or <options.sizeInBytes>, but not both.
|
|
545
|
+
* @exception {DeveloperError} IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system. Check context.elementIndexUint.
|
|
546
|
+
* @exception {DeveloperError} The size in bytes must be greater than zero.
|
|
547
|
+
* @exception {DeveloperError} Invalid <code>usage</code>.
|
|
548
|
+
* @exception {DeveloperError} Invalid <code>indexDatatype</code>.
|
|
549
|
+
*
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* // Example 1. Create a stream index buffer of unsigned shorts that is
|
|
553
|
+
* // 16 bytes in size.
|
|
554
|
+
* var buffer = Buffer.createIndexBuffer({
|
|
555
|
+
* context : context,
|
|
556
|
+
* sizeInBytes : 16,
|
|
557
|
+
* usage : BufferUsage.STREAM_DRAW,
|
|
558
|
+
* indexDatatype : IndexDatatype.UNSIGNED_SHORT
|
|
559
|
+
* });
|
|
560
|
+
*
|
|
561
|
+
* @example
|
|
562
|
+
* // Example 2. Create a static index buffer containing three unsigned shorts.
|
|
563
|
+
* var buffer = Buffer.createIndexBuffer({
|
|
564
|
+
* context : context,
|
|
565
|
+
* typedArray : new Uint16Array([0, 1, 2]),
|
|
566
|
+
* usage : BufferUsage.STATIC_DRAW,
|
|
567
|
+
* indexDatatype : IndexDatatype.UNSIGNED_SHORT
|
|
568
|
+
* });
|
|
569
|
+
*
|
|
570
|
+
* @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGenBuffer.xml|glGenBuffer}
|
|
571
|
+
* @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glBindBuffer.xml|glBindBuffer} with <code>ELEMENT_ARRAY_BUFFER</code>
|
|
572
|
+
* @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glBufferData.xml|glBufferData} with <code>ELEMENT_ARRAY_BUFFER</code>
|
|
573
|
+
*/
|
|
574
|
+
static createIndexBuffer: (options: {
|
|
575
|
+
context: Context
|
|
576
|
+
sizeInBytes?: number
|
|
577
|
+
usage: BufferUsage
|
|
578
|
+
indexDatatype: IndexDatatype
|
|
579
|
+
typedArray?: ArrayBufferView
|
|
580
|
+
}) => Buffer
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* The render pass for a command.
|
|
585
|
+
*
|
|
586
|
+
* @private
|
|
587
|
+
*/
|
|
588
|
+
export enum Pass {
|
|
589
|
+
// If you add/modify/remove Pass constants, also change the automatic GLSL constants
|
|
590
|
+
// that start with 'czm_pass'
|
|
591
|
+
//
|
|
592
|
+
// Commands are executed in order by pass up to the translucent pass.
|
|
593
|
+
// Translucent geometry needs special handling (sorting/OIT). The compute pass
|
|
594
|
+
// is executed first and the overlay pass is executed last. Both are not sorted
|
|
595
|
+
// by frustum.
|
|
596
|
+
ENVIRONMENT = 0,
|
|
597
|
+
COMPUTE = 1,
|
|
598
|
+
GLOBE = 2,
|
|
599
|
+
TERRAIN_CLASSIFICATION = 3,
|
|
600
|
+
CESIUM_3D_TILE = 4,
|
|
601
|
+
CESIUM_3D_TILE_CLASSIFICATION = 5,
|
|
602
|
+
CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW = 6,
|
|
603
|
+
OPAQUE = 7,
|
|
604
|
+
TRANSLUCENT = 8,
|
|
605
|
+
OVERLAY = 9,
|
|
606
|
+
NUMBER_OF_PASSES = 10
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Represents a command to the renderer for clearing a framebuffer.
|
|
611
|
+
*
|
|
612
|
+
* @private
|
|
613
|
+
*/
|
|
614
|
+
export class ClearCommand {
|
|
615
|
+
|
|
616
|
+
constructor(options: {
|
|
617
|
+
/**
|
|
618
|
+
* The value to clear the color buffer to. When <code>undefined</code>, the color buffer is not cleared.
|
|
619
|
+
*
|
|
620
|
+
* @type {Color}
|
|
621
|
+
*
|
|
622
|
+
* @default undefined
|
|
623
|
+
*/
|
|
624
|
+
color: Color
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* The value to clear the depth buffer to. When <code>undefined</code>, the depth buffer is not cleared.
|
|
628
|
+
*
|
|
629
|
+
* @type {Number}
|
|
630
|
+
*
|
|
631
|
+
* @default undefined
|
|
632
|
+
*/
|
|
633
|
+
depth: number
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* The value to clear the stencil buffer to. When <code>undefined</code>, the stencil buffer is not cleared.
|
|
637
|
+
*
|
|
638
|
+
* @type {Number}
|
|
639
|
+
*
|
|
640
|
+
* @default undefined
|
|
641
|
+
*/
|
|
642
|
+
stencil: number
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* The render state to apply when executing the clear command. The following states affect clearing:
|
|
646
|
+
* scissor test, color mask, depth mask, and stencil mask. When the render state is
|
|
647
|
+
* <code>undefined</code>, the default render state is used.
|
|
648
|
+
*
|
|
649
|
+
* @type {RenderState}
|
|
650
|
+
*
|
|
651
|
+
* @default undefined
|
|
652
|
+
*/
|
|
653
|
+
renderState: RenderState
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* The framebuffer to clear.
|
|
657
|
+
*
|
|
658
|
+
* @type {Framebuffer}
|
|
659
|
+
*
|
|
660
|
+
* @default undefined
|
|
661
|
+
*/
|
|
662
|
+
framebuffer: Framebuffer
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* The object who created this command. This is useful for debugging command
|
|
666
|
+
* execution; it allows you to see who created a command when you only have a
|
|
667
|
+
* reference to the command, and can be used to selectively execute commands
|
|
668
|
+
* with {@link Scene#debugCommandFilter}.
|
|
669
|
+
*
|
|
670
|
+
* @type {Object}
|
|
671
|
+
*
|
|
672
|
+
* @default undefined
|
|
673
|
+
*
|
|
674
|
+
* @see Scene#debugCommandFilter
|
|
675
|
+
*/
|
|
676
|
+
owner: object
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* The pass in which to run this command.
|
|
680
|
+
*
|
|
681
|
+
* @type {Pass}
|
|
682
|
+
*
|
|
683
|
+
* @default undefined
|
|
684
|
+
*/
|
|
685
|
+
pass: Pass
|
|
686
|
+
})
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* The value to clear the color buffer to. When <code>undefined</code>, the color buffer is not cleared.
|
|
690
|
+
*
|
|
691
|
+
* @type {Color}
|
|
692
|
+
*
|
|
693
|
+
* @default undefined
|
|
694
|
+
*/
|
|
695
|
+
color: Color
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* The value to clear the depth buffer to. When <code>undefined</code>, the depth buffer is not cleared.
|
|
699
|
+
*
|
|
700
|
+
* @type {Number}
|
|
701
|
+
*
|
|
702
|
+
* @default undefined
|
|
703
|
+
*/
|
|
704
|
+
depth: number
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* The value to clear the stencil buffer to. When <code>undefined</code>, the stencil buffer is not cleared.
|
|
708
|
+
*
|
|
709
|
+
* @type {Number}
|
|
710
|
+
*
|
|
711
|
+
* @default undefined
|
|
712
|
+
*/
|
|
713
|
+
stencil: number
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* The render state to apply when executing the clear command. The following states affect clearing:
|
|
717
|
+
* scissor test, color mask, depth mask, and stencil mask. When the render state is
|
|
718
|
+
* <code>undefined</code>, the default render state is used.
|
|
719
|
+
*
|
|
720
|
+
* @type {RenderState}
|
|
721
|
+
*
|
|
722
|
+
* @default undefined
|
|
723
|
+
*/
|
|
724
|
+
renderState: RenderState
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* The framebuffer to clear.
|
|
728
|
+
*
|
|
729
|
+
* @type {Framebuffer}
|
|
730
|
+
*
|
|
731
|
+
* @default undefined
|
|
732
|
+
*/
|
|
733
|
+
framebuffer: Framebuffer
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* The object who created this command. This is useful for debugging command
|
|
737
|
+
* execution; it allows you to see who created a command when you only have a
|
|
738
|
+
* reference to the command, and can be used to selectively execute commands
|
|
739
|
+
* with {@link Scene#debugCommandFilter}.
|
|
740
|
+
*
|
|
741
|
+
* @type {Object}
|
|
742
|
+
*
|
|
743
|
+
* @default undefined
|
|
744
|
+
*
|
|
745
|
+
* @see Scene#debugCommandFilter
|
|
746
|
+
*/
|
|
747
|
+
owner: object
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* The pass in which to run this command.
|
|
751
|
+
*
|
|
752
|
+
* @type {Pass}
|
|
753
|
+
*
|
|
754
|
+
* @default undefined
|
|
755
|
+
*/
|
|
756
|
+
pass: Pass
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Clears color to (0.0, 0.0, 0.0, 0.0); depth to 1.0; and stencil to 0.
|
|
760
|
+
*
|
|
761
|
+
* @type {ClearCommand}
|
|
762
|
+
*
|
|
763
|
+
* @constant
|
|
764
|
+
*/
|
|
765
|
+
static ALL: ClearCommand
|
|
766
|
+
|
|
767
|
+
execute(context: Context, passState: PassState): void
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* @private
|
|
773
|
+
*/
|
|
774
|
+
class CubeMapFace {
|
|
775
|
+
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* @private
|
|
780
|
+
*/
|
|
781
|
+
export class CubeMap {
|
|
782
|
+
constructor(options: {
|
|
783
|
+
context: Context
|
|
784
|
+
source: {
|
|
785
|
+
positiveX: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement
|
|
786
|
+
negativeX: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement
|
|
787
|
+
positiveY: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement
|
|
788
|
+
negativeY: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement
|
|
789
|
+
positiveZ: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement
|
|
790
|
+
negativeZ: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement
|
|
791
|
+
}
|
|
792
|
+
pixelFormat?: PixelFormat
|
|
793
|
+
pixelDatatype?: PixelDatatype
|
|
794
|
+
preMultiplyAlpha?: boolean
|
|
795
|
+
width?: number
|
|
796
|
+
height?: number
|
|
797
|
+
flipY?: boolean
|
|
798
|
+
})
|
|
799
|
+
|
|
800
|
+
_context: Context
|
|
801
|
+
|
|
802
|
+
positiveX: CubeMapFace
|
|
803
|
+
negativeX: CubeMapFace
|
|
804
|
+
positiveY: CubeMapFace
|
|
805
|
+
negativeY: CubeMapFace
|
|
806
|
+
positiveZ: CubeMapFace
|
|
807
|
+
negativeZ: CubeMapFace
|
|
808
|
+
sampler: Sampler
|
|
809
|
+
pixelFormat: PixelFormat
|
|
810
|
+
pixelDatatype: number
|
|
811
|
+
width: number
|
|
812
|
+
height: number
|
|
813
|
+
sizeInBytes: number
|
|
814
|
+
preMultiplyAlpha: boolean
|
|
815
|
+
flipY: boolean
|
|
816
|
+
|
|
817
|
+
_target: number
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* Generates a complete mipmap chain for each cubemap face.
|
|
821
|
+
*
|
|
822
|
+
* @param {MipmapHint} [hint=MipmapHint.DONT_CARE] A performance vs. quality hint.
|
|
823
|
+
*
|
|
824
|
+
* @exception {DeveloperError} hint is invalid.
|
|
825
|
+
* @exception {DeveloperError} This CubeMap's width must be a power of two to call generateMipmap().
|
|
826
|
+
* @exception {DeveloperError} This CubeMap's height must be a power of two to call generateMipmap().
|
|
827
|
+
* @exception {DeveloperError} This CubeMap was destroyed, i.e., destroy() was called.
|
|
828
|
+
*
|
|
829
|
+
* @example
|
|
830
|
+
* // Generate mipmaps, and then set the sampler so mipmaps are used for
|
|
831
|
+
* // minification when the cube map is sampled.
|
|
832
|
+
* cubeMap.generateMipmap();
|
|
833
|
+
* cubeMap.sampler = new Sampler({
|
|
834
|
+
* minificationFilter : Cesium.TextureMinificationFilter.NEAREST_MIPMAP_LINEAR
|
|
835
|
+
* });
|
|
836
|
+
*/
|
|
837
|
+
generateMipmap(hint): void
|
|
838
|
+
|
|
839
|
+
isDestroyed(): boolean
|
|
840
|
+
|
|
841
|
+
destroy(): any
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Asynchronously loads six images and creates a cube map. Returns a promise that
|
|
846
|
+
* will resolve to a {@link CubeMap} once loaded, or reject if any image fails to load.
|
|
847
|
+
*
|
|
848
|
+
* @function loadCubeMap
|
|
849
|
+
*
|
|
850
|
+
* @param {Context} context The context to use to create the cube map.
|
|
851
|
+
* @param {Object} urls The source URL of each image. See the example below.
|
|
852
|
+
* @returns {Promise.<CubeMap>} a promise that will resolve to the requested {@link CubeMap} when loaded.
|
|
853
|
+
*
|
|
854
|
+
* @exception {DeveloperError} context is required.
|
|
855
|
+
* @exception {DeveloperError} urls is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.
|
|
856
|
+
*
|
|
857
|
+
*
|
|
858
|
+
* @example
|
|
859
|
+
* Cesium.loadCubeMap(context, {
|
|
860
|
+
* positiveX : 'skybox_px.png',
|
|
861
|
+
* negativeX : 'skybox_nx.png',
|
|
862
|
+
* positiveY : 'skybox_py.png',
|
|
863
|
+
* negativeY : 'skybox_ny.png',
|
|
864
|
+
* positiveZ : 'skybox_pz.png',
|
|
865
|
+
* negativeZ : 'skybox_nz.png'
|
|
866
|
+
* }).then(function(cubeMap) {
|
|
867
|
+
* // use the cubemap
|
|
868
|
+
* }).otherwise(function(error) {
|
|
869
|
+
* // an error occurred
|
|
870
|
+
* });
|
|
871
|
+
*
|
|
872
|
+
* @see {@link http://www.w3.org/TR/cors/|Cross-Origin Resource Sharing}
|
|
873
|
+
* @see {@link http://wiki.commonjs.org/wiki/Promises/A|CommonJS Promises/A}
|
|
874
|
+
*
|
|
875
|
+
* @private
|
|
876
|
+
*/
|
|
877
|
+
export function loadCubeMap(context: Context, urls: string): Promise<CubeMap>
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* The state for a particular rendering pass. This is used to supplement the state
|
|
881
|
+
* in a command being executed.
|
|
882
|
+
*
|
|
883
|
+
* @private
|
|
884
|
+
* @constructor
|
|
885
|
+
*/
|
|
886
|
+
export class PassState {
|
|
887
|
+
constructor(context)
|
|
888
|
+
/**
|
|
889
|
+
* The context used to execute commands for this pass.
|
|
890
|
+
*
|
|
891
|
+
* @type {Context}
|
|
892
|
+
*/
|
|
893
|
+
context: Context
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* The framebuffer to render to. This framebuffer is used unless a {@link DrawCommand}
|
|
897
|
+
* or {@link ClearCommand} explicitly define a framebuffer, which is used for off-screen
|
|
898
|
+
* rendering.
|
|
899
|
+
*
|
|
900
|
+
* @type {Framebuffer}
|
|
901
|
+
* @default undefined
|
|
902
|
+
*/
|
|
903
|
+
framebuffer: Framebuffer
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* When defined, this overrides the blending property of a {@link DrawCommand}'s render state.
|
|
907
|
+
* This is used to, for example, to allow the renderer to turn off blending during the picking pass.
|
|
908
|
+
* <p>
|
|
909
|
+
* When this is <code>undefined</code>, the {@link DrawCommand}'s property is used.
|
|
910
|
+
* </p>
|
|
911
|
+
*
|
|
912
|
+
* @type {Boolean}
|
|
913
|
+
* @default undefined
|
|
914
|
+
*/
|
|
915
|
+
blendingEnabled: Boolean
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* When defined, this overrides the scissor test property of a {@link DrawCommand}'s render state.
|
|
919
|
+
* This is used to, for example, to allow the renderer to scissor out the pick region during the picking pass.
|
|
920
|
+
* <p>
|
|
921
|
+
* When this is <code>undefined</code>, the {@link DrawCommand}'s property is used.
|
|
922
|
+
* </p>
|
|
923
|
+
*
|
|
924
|
+
* @type {Object}
|
|
925
|
+
* @default undefined
|
|
926
|
+
*/
|
|
927
|
+
scissorTest: Object
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* The viewport used when one is not defined by a {@link DrawCommand}'s render state.
|
|
931
|
+
* @type {BoundingRectangle}
|
|
932
|
+
* @default undefined
|
|
933
|
+
*/
|
|
934
|
+
viewport: BoundingRectangle
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* @private
|
|
939
|
+
*/
|
|
940
|
+
interface PickId {
|
|
941
|
+
_pickObjects: object
|
|
942
|
+
key: string
|
|
943
|
+
color: Color
|
|
944
|
+
destroy: () => void
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* @private
|
|
949
|
+
*/
|
|
950
|
+
abstract class IRenderState {
|
|
951
|
+
frontFace: WindingOrder //= defaultValue(rs.frontFace, WindingOrder.COUNTER_CLOCKWISE);
|
|
952
|
+
cull: {
|
|
953
|
+
enabled: boolean// defaultValue(cull.enabled, false),
|
|
954
|
+
face: CullFace// WebGLConstants.BACK|WebGLConstants.FRONT|WebGLConstants.FRONT_AND_BACK //defaultValue(cull.face, WebGLConstants.BACK),
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
lineWidth: number//= defaultValue(rs.lineWidth, 1.0);
|
|
958
|
+
polygonOffset: {
|
|
959
|
+
enabled: boolean //defaultValue(polygonOffset.enabled, false),
|
|
960
|
+
factor: number // defaultValue(polygonOffset.factor, 0),
|
|
961
|
+
units: number// defaultValue(polygonOffset.units, 0),
|
|
962
|
+
};
|
|
963
|
+
scissorTest: {
|
|
964
|
+
enabled: boolean// defaultValue(scissorTest.enabled, false),
|
|
965
|
+
rectangle: BoundingRectangle// BoundingRectangle.clone(scissorTestRectangle),
|
|
966
|
+
};
|
|
967
|
+
depthRange: {
|
|
968
|
+
near: number// defaultValue(depthRange.near, 0),
|
|
969
|
+
far: number//defaultValue(depthRange.far, 1),
|
|
970
|
+
};
|
|
971
|
+
depthTest: {
|
|
972
|
+
enabled: boolean// defaultValue(depthTest.enabled, false),
|
|
973
|
+
func: DepthFunction// WebGLConstants.LESS|WebGLConstants.LEQUAL|WebGLConstants.GREATER|WebGLConstants.GEQUAL //defaultValue(depthTest.func, WebGLConstants.LESS), // func, because function is a JavaScript keyword
|
|
974
|
+
};
|
|
975
|
+
colorMask: {
|
|
976
|
+
red: boolean// defaultValue(colorMask.red, true),
|
|
977
|
+
green: boolean//defaultValue(colorMask.green, true),
|
|
978
|
+
blue: boolean//defaultValue(colorMask.blue, true),
|
|
979
|
+
alpha: boolean//defaultValue(colorMask.alpha, true),
|
|
980
|
+
};
|
|
981
|
+
depthMask: boolean// defaultValue(rs.depthMask, true);
|
|
982
|
+
stencilMask: number// defaultValue(rs.stencilMask, ~0);
|
|
983
|
+
blending: {
|
|
984
|
+
enabled: boolean// defaultValue(blending.enabled, false),
|
|
985
|
+
color: Color
|
|
986
|
+
equationRgb: BlendEquation// WebGLConstants.FUNC_ADD|WebGLConstants.FUNC_SUBTRACT|WebGLConstants.FUNC_REVERSE_SUBTRACT //defaultValue(blending.equationRgb, WebGLConstants.FUNC_ADD),
|
|
987
|
+
equationAlpha: BlendEquation //WebGLConstants.FUNC_ADD|WebGLConstants.FUNC_SUBTRACT|WebGLConstants.FUNC_REVERSE_SUBTRACT
|
|
988
|
+
// defaultValue(
|
|
989
|
+
// blending.equationAlpha,
|
|
990
|
+
// WebGLConstants.FUNC_ADD
|
|
991
|
+
// ),
|
|
992
|
+
functionSourceRgb: BlendFunction// WebGLConstants.ONE| WebGLConstants.ZERO| WebGLConstants.ON
|
|
993
|
+
// defaultValue(
|
|
994
|
+
// blending.functionSourceRgb,
|
|
995
|
+
// WebGLConstants.ONE
|
|
996
|
+
// ),
|
|
997
|
+
functionSourceAlpha: BlendFunction
|
|
998
|
+
// defaultValue(
|
|
999
|
+
// blending.functionSourceAlpha,
|
|
1000
|
+
// WebGLConstants.ONE
|
|
1001
|
+
// ),
|
|
1002
|
+
functionDestinationRgb: BlendFunction
|
|
1003
|
+
functionDestinationAlpha: BlendFunction
|
|
1004
|
+
};
|
|
1005
|
+
stencilTest: {
|
|
1006
|
+
enabled: boolean //defaultValue(stencilTest.enabled, false),
|
|
1007
|
+
frontFunction: StencilFunction
|
|
1008
|
+
backFunction: StencilFunction //defaultValue(stencilTest.backFunction, WebGLConstants.ALWAYS),
|
|
1009
|
+
reference: number// defaultValue(stencilTest.reference, 0),
|
|
1010
|
+
mask: number// defaultValue(stencilTest.mask, ~0),
|
|
1011
|
+
frontOperation: {
|
|
1012
|
+
fail: StencilOperation //defaultValue(stencilTestFrontOperation.fail, WebGLConstants.KEEP),
|
|
1013
|
+
zFail: StencilOperation//defaultValue(stencilTestFrontOperation.zFail, WebGLConstants.KEEP),
|
|
1014
|
+
zPass: StencilOperation// defaultValue(stencilTestFrontOperation.zPass, WebGLConstants.KEEP),
|
|
1015
|
+
},
|
|
1016
|
+
backOperation: {
|
|
1017
|
+
fail: StencilOperation//defaultValue(stencilTestBackOperation.fail, WebGLConstants.KEEP),
|
|
1018
|
+
zFail: StencilOperation//defaultValue(stencilTestBackOperation.zFail, WebGLConstants.KEEP),
|
|
1019
|
+
zPass: StencilOperation//defaultValue(stencilTestBackOperation.zPass, WebGLConstants.KEEP),
|
|
1020
|
+
},
|
|
1021
|
+
};
|
|
1022
|
+
sampleCoverage: {
|
|
1023
|
+
enabled: boolean// defaultValue(sampleCoverage.enabled, false),
|
|
1024
|
+
value: number// defaultValue(sampleCoverage.value, 1.0),
|
|
1025
|
+
invert: boolean// defaultValue(sampleCoverage.invert, false),
|
|
1026
|
+
};
|
|
1027
|
+
viewport: {
|
|
1028
|
+
x: number
|
|
1029
|
+
y: number
|
|
1030
|
+
width: number
|
|
1031
|
+
height: number
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* @private
|
|
1037
|
+
*/
|
|
1038
|
+
export class RenderState extends IRenderState {
|
|
1039
|
+
constructor(renderState: IRenderState)
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Validates and then finds or creates an immutable render state, which defines the pipeline
|
|
1043
|
+
* state for a {@link DrawCommand} or {@link ClearCommand}. All inputs states are optional. Omitted states
|
|
1044
|
+
* use the defaults shown in the example below.
|
|
1045
|
+
*
|
|
1046
|
+
* @param {Object} [renderState] The states defining the render state as shown in the example below.
|
|
1047
|
+
*
|
|
1048
|
+
* @exception {RuntimeError} renderState.lineWidth is out of range.
|
|
1049
|
+
* @exception {DeveloperError} Invalid renderState.frontFace.
|
|
1050
|
+
* @exception {DeveloperError} Invalid renderState.cull.face.
|
|
1051
|
+
* @exception {DeveloperError} scissorTest.rectangle.width and scissorTest.rectangle.height must be greater than or equal to zero.
|
|
1052
|
+
* @exception {DeveloperError} renderState.depthRange.near can't be greater than renderState.depthRange.far.
|
|
1053
|
+
* @exception {DeveloperError} renderState.depthRange.near must be greater than or equal to zero.
|
|
1054
|
+
* @exception {DeveloperError} renderState.depthRange.far must be less than or equal to zero.
|
|
1055
|
+
* @exception {DeveloperError} Invalid renderState.depthTest.func.
|
|
1056
|
+
* @exception {DeveloperError} renderState.blending.color components must be greater than or equal to zero and less than or equal to one
|
|
1057
|
+
* @exception {DeveloperError} Invalid renderState.blending.equationRgb.
|
|
1058
|
+
* @exception {DeveloperError} Invalid renderState.blending.equationAlpha.
|
|
1059
|
+
* @exception {DeveloperError} Invalid renderState.blending.functionSourceRgb.
|
|
1060
|
+
* @exception {DeveloperError} Invalid renderState.blending.functionSourceAlpha.
|
|
1061
|
+
* @exception {DeveloperError} Invalid renderState.blending.functionDestinationRgb.
|
|
1062
|
+
* @exception {DeveloperError} Invalid renderState.blending.functionDestinationAlpha.
|
|
1063
|
+
* @exception {DeveloperError} Invalid renderState.stencilTest.frontFunction.
|
|
1064
|
+
* @exception {DeveloperError} Invalid renderState.stencilTest.backFunction.
|
|
1065
|
+
* @exception {DeveloperError} Invalid renderState.stencilTest.frontOperation.fail.
|
|
1066
|
+
* @exception {DeveloperError} Invalid renderState.stencilTest.frontOperation.zFail.
|
|
1067
|
+
* @exception {DeveloperError} Invalid renderState.stencilTest.frontOperation.zPass.
|
|
1068
|
+
* @exception {DeveloperError} Invalid renderState.stencilTest.backOperation.fail.
|
|
1069
|
+
* @exception {DeveloperError} Invalid renderState.stencilTest.backOperation.zFail.
|
|
1070
|
+
* @exception {DeveloperError} Invalid renderState.stencilTest.backOperation.zPass.
|
|
1071
|
+
* @exception {DeveloperError} renderState.viewport.width must be greater than or equal to zero.
|
|
1072
|
+
* @exception {DeveloperError} renderState.viewport.width must be less than or equal to the maximum viewport width.
|
|
1073
|
+
* @exception {DeveloperError} renderState.viewport.height must be greater than or equal to zero.
|
|
1074
|
+
* @exception {DeveloperError} renderState.viewport.height must be less than or equal to the maximum viewport height.
|
|
1075
|
+
*
|
|
1076
|
+
*
|
|
1077
|
+
* @example
|
|
1078
|
+
* var defaults = {
|
|
1079
|
+
* frontFace : WindingOrder.COUNTER_CLOCKWISE,
|
|
1080
|
+
* cull : {
|
|
1081
|
+
* enabled : false,
|
|
1082
|
+
* face : CullFace.BACK
|
|
1083
|
+
* },
|
|
1084
|
+
* lineWidth : 1,
|
|
1085
|
+
* polygonOffset : {
|
|
1086
|
+
* enabled : false,
|
|
1087
|
+
* factor : 0,
|
|
1088
|
+
* units : 0
|
|
1089
|
+
* },
|
|
1090
|
+
* scissorTest : {
|
|
1091
|
+
* enabled : false,
|
|
1092
|
+
* rectangle : {
|
|
1093
|
+
* x : 0,
|
|
1094
|
+
* y : 0,
|
|
1095
|
+
* width : 0,
|
|
1096
|
+
* height : 0
|
|
1097
|
+
* }
|
|
1098
|
+
* },
|
|
1099
|
+
* depthRange : {
|
|
1100
|
+
* near : 0,
|
|
1101
|
+
* far : 1
|
|
1102
|
+
* },
|
|
1103
|
+
* depthTest : {
|
|
1104
|
+
* enabled : false,
|
|
1105
|
+
* func : DepthFunction.LESS
|
|
1106
|
+
* },
|
|
1107
|
+
* colorMask : {
|
|
1108
|
+
* red : true,
|
|
1109
|
+
* green : true,
|
|
1110
|
+
* blue : true,
|
|
1111
|
+
* alpha : true
|
|
1112
|
+
* },
|
|
1113
|
+
* depthMask : true,
|
|
1114
|
+
* stencilMask : ~0,
|
|
1115
|
+
* blending : {
|
|
1116
|
+
* enabled : false,
|
|
1117
|
+
* color : {
|
|
1118
|
+
* red : 0.0,
|
|
1119
|
+
* green : 0.0,
|
|
1120
|
+
* blue : 0.0,
|
|
1121
|
+
* alpha : 0.0
|
|
1122
|
+
* },
|
|
1123
|
+
* equationRgb : BlendEquation.ADD,
|
|
1124
|
+
* equationAlpha : BlendEquation.ADD,
|
|
1125
|
+
* functionSourceRgb : BlendFunction.ONE,
|
|
1126
|
+
* functionSourceAlpha : BlendFunction.ONE,
|
|
1127
|
+
* functionDestinationRgb : BlendFunction.ZERO,
|
|
1128
|
+
* functionDestinationAlpha : BlendFunction.ZERO
|
|
1129
|
+
* },
|
|
1130
|
+
* stencilTest : {
|
|
1131
|
+
* enabled : false,
|
|
1132
|
+
* frontFunction : StencilFunction.ALWAYS,
|
|
1133
|
+
* backFunction : StencilFunction.ALWAYS,
|
|
1134
|
+
* reference : 0,
|
|
1135
|
+
* mask : ~0,
|
|
1136
|
+
* frontOperation : {
|
|
1137
|
+
* fail : StencilOperation.KEEP,
|
|
1138
|
+
* zFail : StencilOperation.KEEP,
|
|
1139
|
+
* zPass : StencilOperation.KEEP
|
|
1140
|
+
* },
|
|
1141
|
+
* backOperation : {
|
|
1142
|
+
* fail : StencilOperation.KEEP,
|
|
1143
|
+
* zFail : StencilOperation.KEEP,
|
|
1144
|
+
* zPass : StencilOperation.KEEP
|
|
1145
|
+
* }
|
|
1146
|
+
* },
|
|
1147
|
+
* sampleCoverage : {
|
|
1148
|
+
* enabled : false,
|
|
1149
|
+
* value : 1.0,
|
|
1150
|
+
* invert : false
|
|
1151
|
+
* }
|
|
1152
|
+
* };
|
|
1153
|
+
*
|
|
1154
|
+
* var rs = RenderState.fromCache(defaults);
|
|
1155
|
+
*
|
|
1156
|
+
* @see DrawCommand
|
|
1157
|
+
* @see ClearCommand
|
|
1158
|
+
*
|
|
1159
|
+
* @private
|
|
1160
|
+
*/
|
|
1161
|
+
static fromCache: (renderState: IRenderState) => RenderState
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* @private
|
|
1167
|
+
* @constructor
|
|
1168
|
+
*/
|
|
1169
|
+
export class Context {
|
|
1170
|
+
constructor(canvas: HTMLCanvasElement, options: Object)
|
|
1171
|
+
|
|
1172
|
+
isDestroyed: () => void
|
|
1173
|
+
|
|
1174
|
+
destroy: () => any
|
|
1175
|
+
/**
|
|
1176
|
+
* Creates a unique ID associated with the input object for use with color-buffer picking.
|
|
1177
|
+
* The ID has an RGBA color value unique to this context. You must call destroy()
|
|
1178
|
+
* on the pick ID when destroying the input object.
|
|
1179
|
+
*
|
|
1180
|
+
* @param {Object} object The object to associate with the pick ID.
|
|
1181
|
+
* @returns {Object} A PickId object with a <code>color</code> property.
|
|
1182
|
+
*
|
|
1183
|
+
* @exception {RuntimeError} Out of unique Pick IDs.
|
|
1184
|
+
*
|
|
1185
|
+
*
|
|
1186
|
+
* @example
|
|
1187
|
+
* this._pickId = context.createPickId({
|
|
1188
|
+
* primitive : this,
|
|
1189
|
+
* id : this.id
|
|
1190
|
+
* });
|
|
1191
|
+
*
|
|
1192
|
+
* @see Context#getObjectByPickColor
|
|
1193
|
+
*/
|
|
1194
|
+
createPickId: (object: Object) => Object
|
|
1195
|
+
/**
|
|
1196
|
+
* Gets the object associated with a pick color.
|
|
1197
|
+
*
|
|
1198
|
+
* @param {Color} pickColor The pick color.
|
|
1199
|
+
* @returns {Object} The object associated with the pick color, or undefined if no object is associated with that color.
|
|
1200
|
+
*
|
|
1201
|
+
* @example
|
|
1202
|
+
* var object = context.getObjectByPickColor(pickColor);
|
|
1203
|
+
*
|
|
1204
|
+
* @see Context#createPickId
|
|
1205
|
+
*/
|
|
1206
|
+
getObjectByPickColor: (pickColor: Color) => Object
|
|
1207
|
+
|
|
1208
|
+
getViewportQuadVertexArray: () => VertexArray
|
|
1209
|
+
createViewportQuadCommand: (
|
|
1210
|
+
fragmentShaderSource: string,
|
|
1211
|
+
overrides?: {
|
|
1212
|
+
renderState?: RenderState
|
|
1213
|
+
uniformMap?: { [key: string]: () => (number | boolean | number[] | Cartesian2 | Cartesian3 | Cartesian4 | Color | Matrix2 | Matrix3 | Matrix4 | Texture | CubeMap) }
|
|
1214
|
+
owner?: object
|
|
1215
|
+
framebuffer?: Framebuffer
|
|
1216
|
+
pass?: Pass
|
|
1217
|
+
}
|
|
1218
|
+
) => DrawCommand
|
|
1219
|
+
readPixels: (readState?: {
|
|
1220
|
+
x?: number
|
|
1221
|
+
y?: number
|
|
1222
|
+
width?: number
|
|
1223
|
+
height?: number
|
|
1224
|
+
framebuffer?: Framebuffer;
|
|
1225
|
+
}) => ArrayBufferView
|
|
1226
|
+
endFrame: () => void
|
|
1227
|
+
draw: (drawCommand: DrawCommand, passState: PassState, shaderProgram: ShaderProgram, uniformMap: { [key: string]: () => (number | boolean | number[] | Cartesian2 | Cartesian3 | Cartesian4 | Color | Matrix2 | Matrix3 | Matrix4 | Texture | CubeMap) }) => void
|
|
1228
|
+
clear: (clearCommand: ClearCommand, passState: PassState) => void
|
|
1229
|
+
/**
|
|
1230
|
+
* The number of stencil bits per pixel in the default bound framebuffer. The minimum is eight bits.
|
|
1231
|
+
* @memberof Context.prototype
|
|
1232
|
+
* @type {Number}
|
|
1233
|
+
* @readonly
|
|
1234
|
+
* @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>STENCIL_BITS</code>.
|
|
1235
|
+
*/
|
|
1236
|
+
stencilBits: number
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* <code>true</code> if the WebGL context supports stencil buffers.
|
|
1240
|
+
* Stencil buffers are not supported by all systems.
|
|
1241
|
+
* @memberof Context.prototype
|
|
1242
|
+
* @type {Boolean}
|
|
1243
|
+
* @readonly
|
|
1244
|
+
*/
|
|
1245
|
+
stencilBuffer: boolean
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* <code>true</code> if the WebGL context supports antialiasing. By default
|
|
1249
|
+
* antialiasing is requested, but it is not supported by all systems.
|
|
1250
|
+
* @memberof Context.prototype
|
|
1251
|
+
* @type {Boolean}
|
|
1252
|
+
* @readonly
|
|
1253
|
+
*/
|
|
1254
|
+
antialias: boolean
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* <code>true</code> if the OES_standard_derivatives extension is supported. This
|
|
1258
|
+
* extension provides access to <code>dFdx</code>, <code>dFdy</code>, and <code>fwidth</code>
|
|
1259
|
+
* functions from GLSL. A shader using these functions still needs to explicitly enable the
|
|
1260
|
+
* extension with <code>#extension GL_OES_standard_derivatives : enable</code>.
|
|
1261
|
+
* @memberof Context.prototype
|
|
1262
|
+
* @type {Boolean}
|
|
1263
|
+
* @readonly
|
|
1264
|
+
* @see {@link http://www.khronos.org/registry/gles/extensions/OES/OES_standard_derivatives.txt|OES_standard_derivatives}
|
|
1265
|
+
*/
|
|
1266
|
+
standardDerivatives: boolean
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
* <code>true</code> if the EXT_float_blend extension is supported. This
|
|
1270
|
+
* extension enables blending with 32-bit float values.
|
|
1271
|
+
* @memberof Context.prototype
|
|
1272
|
+
* @type {Boolean}
|
|
1273
|
+
* @readonly
|
|
1274
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/EXT_float_blend/}
|
|
1275
|
+
*/
|
|
1276
|
+
floatBlend: boolean
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* <code>true</code> if the EXT_blend_minmax extension is supported. This
|
|
1280
|
+
* extension extends blending capabilities by adding two new blend equations:
|
|
1281
|
+
* the minimum or maximum color components of the source and destination colors.
|
|
1282
|
+
* @memberof Context.prototype
|
|
1283
|
+
* @type {Boolean}
|
|
1284
|
+
* @readonly
|
|
1285
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/EXT_blend_minmax/}
|
|
1286
|
+
*/
|
|
1287
|
+
blendMinmax: boolean
|
|
1288
|
+
|
|
1289
|
+
/**
|
|
1290
|
+
* <code>true</code> if the OES_element_index_uint extension is supported. This
|
|
1291
|
+
* extension allows the use of unsigned int indices, which can improve performance by
|
|
1292
|
+
* eliminating batch breaking caused by unsigned short indices.
|
|
1293
|
+
* @memberof Context.prototype
|
|
1294
|
+
* @type {Boolean}
|
|
1295
|
+
* @readonly
|
|
1296
|
+
* @see {@link http://www.khronos.org/registry/webgl/extensions/OES_element_index_uint/|OES_element_index_uint}
|
|
1297
|
+
*/
|
|
1298
|
+
elementIndexUint: boolean
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* <code>true</code> if WEBGL_depth_texture is supported. This extension provides
|
|
1302
|
+
* access to depth textures that, for example, can be attached to framebuffers for shadow mapping.
|
|
1303
|
+
* @memberof Context.prototype
|
|
1304
|
+
* @type {Boolean}
|
|
1305
|
+
* @readonly
|
|
1306
|
+
* @see {@link http://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/|WEBGL_depth_texture}
|
|
1307
|
+
*/
|
|
1308
|
+
depthTexture: boolean
|
|
1309
|
+
|
|
1310
|
+
/**
|
|
1311
|
+
* <code>true</code> if OES_texture_float is supported. This extension provides
|
|
1312
|
+
* access to floating point textures that, for example, can be attached to framebuffers for high dynamic range.
|
|
1313
|
+
* @memberof Context.prototype
|
|
1314
|
+
* @type {Boolean}
|
|
1315
|
+
* @readonly
|
|
1316
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/OES_texture_float/}
|
|
1317
|
+
*/
|
|
1318
|
+
floatingPointTexture: boolean
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* <code>true</code> if OES_texture_half_float is supported. This extension provides
|
|
1322
|
+
* access to floating point textures that, for example, can be attached to framebuffers for high dynamic range.
|
|
1323
|
+
* @memberof Context.prototype
|
|
1324
|
+
* @type {Boolean}
|
|
1325
|
+
* @readonly
|
|
1326
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/OES_texture_float/}
|
|
1327
|
+
*/
|
|
1328
|
+
halfFloatingPointTexture: boolean
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* <code>true</code> if OES_texture_float_linear is supported. This extension provides
|
|
1332
|
+
* access to linear sampling methods for minification and magnification filters of floating-point textures.
|
|
1333
|
+
* @memberof Context.prototype
|
|
1334
|
+
* @type {Boolean}
|
|
1335
|
+
* @readonly
|
|
1336
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/OES_texture_float_linear/}
|
|
1337
|
+
*/
|
|
1338
|
+
textureFloatLinear: boolean
|
|
1339
|
+
|
|
1340
|
+
/**
|
|
1341
|
+
* <code>true</code> if OES_texture_half_float_linear is supported. This extension provides
|
|
1342
|
+
* access to linear sampling methods for minification and magnification filters of half floating-point textures.
|
|
1343
|
+
* @memberof Context.prototype
|
|
1344
|
+
* @type {Boolean}
|
|
1345
|
+
* @readonly
|
|
1346
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/OES_texture_half_float_linear/}
|
|
1347
|
+
*/
|
|
1348
|
+
textureHalfFloatLinear: boolean
|
|
1349
|
+
/**
|
|
1350
|
+
* <code>true</code> if EXT_texture_filter_anisotropic is supported. This extension provides
|
|
1351
|
+
* access to anisotropic filtering for textured surfaces at an oblique angle from the viewer.
|
|
1352
|
+
* @memberof Context.prototype
|
|
1353
|
+
* @type {Boolean}
|
|
1354
|
+
* @readonly
|
|
1355
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/EXT_texture_filter_anisotropic/}
|
|
1356
|
+
*/
|
|
1357
|
+
textureFilterAnisotropic: boolean
|
|
1358
|
+
|
|
1359
|
+
/**
|
|
1360
|
+
* <code>true</code> if WEBGL_texture_compression_s3tc is supported. This extension provides
|
|
1361
|
+
* access to DXT compressed textures.
|
|
1362
|
+
* @memberof Context.prototype
|
|
1363
|
+
* @type {Boolean}
|
|
1364
|
+
* @readonly
|
|
1365
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/}
|
|
1366
|
+
*/
|
|
1367
|
+
s3tc: boolean
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* <code>true</code> if WEBGL_texture_compression_pvrtc is supported. This extension provides
|
|
1371
|
+
* access to PVR compressed textures.
|
|
1372
|
+
* @memberof Context.prototype
|
|
1373
|
+
* @type {Boolean}
|
|
1374
|
+
* @readonly
|
|
1375
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_pvrtc/}
|
|
1376
|
+
*/
|
|
1377
|
+
pvrtc: boolean
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
* <code>true</code> if WEBGL_texture_compression_etc1 is supported. This extension provides
|
|
1381
|
+
* access to ETC1 compressed textures.
|
|
1382
|
+
* @memberof Context.prototype
|
|
1383
|
+
* @type {Boolean}
|
|
1384
|
+
* @readonly
|
|
1385
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc1/}
|
|
1386
|
+
*/
|
|
1387
|
+
etc1: boolean
|
|
1388
|
+
|
|
1389
|
+
/**
|
|
1390
|
+
* <code>true</code> if the OES_vertex_array_object extension is supported. This
|
|
1391
|
+
* extension can improve performance by reducing the overhead of switching vertex arrays.
|
|
1392
|
+
* When enabled, this extension is automatically used by {@link VertexArray}.
|
|
1393
|
+
* @memberof Context.prototype
|
|
1394
|
+
* @type {Boolean}
|
|
1395
|
+
* @readonly
|
|
1396
|
+
* @see {@link http://www.khronos.org/registry/webgl/extensions/OES_vertex_array_object/|OES_vertex_array_object}
|
|
1397
|
+
*/
|
|
1398
|
+
vertexArrayObject: boolean
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* <code>true</code> if the EXT_frag_depth extension is supported. This
|
|
1402
|
+
* extension provides access to the <code>gl_FragDepthEXT</code> built-in output variable
|
|
1403
|
+
* from GLSL fragment shaders. A shader using these functions still needs to explicitly enable the
|
|
1404
|
+
* extension with <code>#extension GL_EXT_frag_depth : enable</code>.
|
|
1405
|
+
* @memberof Context.prototype
|
|
1406
|
+
* @type {Boolean}
|
|
1407
|
+
* @readonly
|
|
1408
|
+
* @see {@link http://www.khronos.org/registry/webgl/extensions/EXT_frag_depth/|EXT_frag_depth}
|
|
1409
|
+
*/
|
|
1410
|
+
fragmentDepth: boolean
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* <code>true</code> if the ANGLE_instanced_arrays extension is supported. This
|
|
1414
|
+
* extension provides access to instanced rendering.
|
|
1415
|
+
* @memberof Context.prototype
|
|
1416
|
+
* @type {Boolean}
|
|
1417
|
+
* @readonly
|
|
1418
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays}
|
|
1419
|
+
*/
|
|
1420
|
+
instancedArrays: boolean
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* <code>true</code> if the EXT_color_buffer_float extension is supported. This
|
|
1424
|
+
* extension makes the gl.RGBA32F format color renderable.
|
|
1425
|
+
* @memberof Context.prototype
|
|
1426
|
+
* @type {Boolean}
|
|
1427
|
+
* @readonly
|
|
1428
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/WEBGL_color_buffer_float/}
|
|
1429
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/EXT_color_buffer_float/}
|
|
1430
|
+
*/
|
|
1431
|
+
colorBufferFloat: boolean
|
|
1432
|
+
|
|
1433
|
+
/**
|
|
1434
|
+
* <code>true</code> if the EXT_color_buffer_half_float extension is supported. This
|
|
1435
|
+
* extension makes the format gl.RGBA16F format color renderable.
|
|
1436
|
+
* @memberof Context.prototype
|
|
1437
|
+
* @type {Boolean}
|
|
1438
|
+
* @readonly
|
|
1439
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/EXT_color_buffer_half_float/}
|
|
1440
|
+
* @see {@link https://www.khronos.org/registry/webgl/extensions/EXT_color_buffer_float/}
|
|
1441
|
+
*/
|
|
1442
|
+
colorBufferHalfFloat: boolean
|
|
1443
|
+
|
|
1444
|
+
/**
|
|
1445
|
+
* <code>true</code> if the WEBGL_draw_buffers extension is supported. This
|
|
1446
|
+
* extensions provides support for multiple render targets. The framebuffer object can have mutiple
|
|
1447
|
+
* color attachments and the GLSL fragment shader can write to the built-in output array <code>gl_FragData</code>.
|
|
1448
|
+
* A shader using this feature needs to explicitly enable the extension with
|
|
1449
|
+
* <code>#extension GL_EXT_draw_buffers : enable</code>.
|
|
1450
|
+
* @memberof Context.prototype
|
|
1451
|
+
* @type {Boolean}
|
|
1452
|
+
* @readonly
|
|
1453
|
+
* @see {@link http://www.khronos.org/registry/webgl/extensions/WEBGL_draw_buffers/|WEBGL_draw_buffers}
|
|
1454
|
+
*/
|
|
1455
|
+
drawBuffers: boolean
|
|
1456
|
+
|
|
1457
|
+
|
|
1458
|
+
/**
|
|
1459
|
+
* A 1x1 RGBA texture initialized to [255, 255, 255, 255]. This can
|
|
1460
|
+
* be used as a placeholder texture while other textures are downloaded.
|
|
1461
|
+
* @memberof Context.prototype
|
|
1462
|
+
* @type {Texture}
|
|
1463
|
+
* @readonly
|
|
1464
|
+
*/
|
|
1465
|
+
defaultTexture: Texture
|
|
1466
|
+
|
|
1467
|
+
/**
|
|
1468
|
+
* A cube map, where each face is a 1x1 RGBA texture initialized to
|
|
1469
|
+
* [255, 255, 255, 255]. This can be used as a placeholder cube map while
|
|
1470
|
+
* other cube maps are downloaded.
|
|
1471
|
+
* @memberof Context.prototype
|
|
1472
|
+
* @type {CubeMap}
|
|
1473
|
+
* @readonly
|
|
1474
|
+
*/
|
|
1475
|
+
defaultCubeMap: CubeMap
|
|
1476
|
+
|
|
1477
|
+
/**
|
|
1478
|
+
* The drawingBufferHeight of the underlying GL context.
|
|
1479
|
+
* @memberof Context.prototype
|
|
1480
|
+
* @type {Number}
|
|
1481
|
+
* @readonly
|
|
1482
|
+
* @see {@link https://www.khronos.org/registry/webgl/specs/1.0/#DOM-WebGLRenderingContext-drawingBufferHeight|drawingBufferHeight}
|
|
1483
|
+
*/
|
|
1484
|
+
drawingBufferHeight: number
|
|
1485
|
+
|
|
1486
|
+
/**
|
|
1487
|
+
* The drawingBufferWidth of the underlying GL context.
|
|
1488
|
+
* @memberof Context.prototype
|
|
1489
|
+
* @type {Number}
|
|
1490
|
+
* @readonly
|
|
1491
|
+
* @see {@link https://www.khronos.org/registry/webgl/specs/1.0/#DOM-WebGLRenderingContext-drawingBufferWidth|drawingBufferWidth}
|
|
1492
|
+
*/
|
|
1493
|
+
drawingBufferWidth: number
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* Gets an object representing the currently bound framebuffer. While this instance is not an actual
|
|
1497
|
+
* {@link Framebuffer}, it is used to represent the default framebuffer in calls to
|
|
1498
|
+
* {@link Texture.fromFramebuffer}.
|
|
1499
|
+
* @memberof Context.prototype
|
|
1500
|
+
* @type {Object}
|
|
1501
|
+
* @readonly
|
|
1502
|
+
*/
|
|
1503
|
+
defaultFramebuffer: Framebuffer
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
/**
|
|
1507
|
+
* @private
|
|
1508
|
+
*/
|
|
1509
|
+
interface VertexArrayAttribute {
|
|
1510
|
+
index: number
|
|
1511
|
+
vertexBuffer: Buffer
|
|
1512
|
+
componentsPerAttribute: number
|
|
1513
|
+
componentDatatype: ComponentDatatype
|
|
1514
|
+
/**
|
|
1515
|
+
* @default false
|
|
1516
|
+
*/
|
|
1517
|
+
normalize?: boolean
|
|
1518
|
+
/**
|
|
1519
|
+
* @default 0
|
|
1520
|
+
*/
|
|
1521
|
+
offsetInBytes?: number
|
|
1522
|
+
/**
|
|
1523
|
+
* @default 0
|
|
1524
|
+
*/
|
|
1525
|
+
strideInBytes?: number
|
|
1526
|
+
/**
|
|
1527
|
+
* @default 0
|
|
1528
|
+
*/
|
|
1529
|
+
instanceDivisor?: number
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* Creates a vertex array, which defines the attributes making up a vertex, and contains an optional index buffer
|
|
1534
|
+
* to select vertices for rendering. Attributes are defined using object literals as shown in Example 1 below.
|
|
1535
|
+
*
|
|
1536
|
+
* @param {Object} options Object with the following properties:
|
|
1537
|
+
* @param {Context} options.context The context in which the VertexArray gets created.
|
|
1538
|
+
* @param {Object[]} options.attributes An array of attributes.
|
|
1539
|
+
* @param {IndexBuffer} [options.indexBuffer] An optional index buffer.
|
|
1540
|
+
*
|
|
1541
|
+
* @returns {VertexArray} The vertex array, ready for use with drawing.
|
|
1542
|
+
*
|
|
1543
|
+
* @exception {DeveloperError} Attribute must have a <code>vertexBuffer</code>.
|
|
1544
|
+
* @exception {DeveloperError} Attribute must have a <code>componentsPerAttribute</code>.
|
|
1545
|
+
* @exception {DeveloperError} Attribute must have a valid <code>componentDatatype</code> or not specify it.
|
|
1546
|
+
* @exception {DeveloperError} Attribute must have a <code>strideInBytes</code> less than or equal to 255 or not specify it.
|
|
1547
|
+
* @exception {DeveloperError} Index n is used by more than one attribute.
|
|
1548
|
+
*
|
|
1549
|
+
*
|
|
1550
|
+
* @example
|
|
1551
|
+
* // Example 1. Create a vertex array with vertices made up of three floating point
|
|
1552
|
+
* // values, e.g., a position, from a single vertex buffer. No index buffer is used.
|
|
1553
|
+
* var positionBuffer = Buffer.createVertexBuffer({
|
|
1554
|
+
* context : context,
|
|
1555
|
+
* sizeInBytes : 12,
|
|
1556
|
+
* usage : BufferUsage.STATIC_DRAW
|
|
1557
|
+
* });
|
|
1558
|
+
* var attributes = [
|
|
1559
|
+
* {
|
|
1560
|
+
* index : 0,
|
|
1561
|
+
* enabled : true,
|
|
1562
|
+
* vertexBuffer : positionBuffer,
|
|
1563
|
+
* componentsPerAttribute : 3,
|
|
1564
|
+
* componentDatatype : ComponentDatatype.FLOAT,
|
|
1565
|
+
* normalize : false,
|
|
1566
|
+
* offsetInBytes : 0,
|
|
1567
|
+
* strideInBytes : 0 // tightly packed
|
|
1568
|
+
* instanceDivisor : 0 // not instanced
|
|
1569
|
+
* }
|
|
1570
|
+
* ];
|
|
1571
|
+
* var va = new VertexArray({
|
|
1572
|
+
* context : context,
|
|
1573
|
+
* attributes : attributes
|
|
1574
|
+
* });
|
|
1575
|
+
*
|
|
1576
|
+
* @example
|
|
1577
|
+
* // Example 2. Create a vertex array with vertices from two different vertex buffers.
|
|
1578
|
+
* // Each vertex has a three-component position and three-component normal.
|
|
1579
|
+
* var positionBuffer = Buffer.createVertexBuffer({
|
|
1580
|
+
* context : context,
|
|
1581
|
+
* sizeInBytes : 12,
|
|
1582
|
+
* usage : BufferUsage.STATIC_DRAW
|
|
1583
|
+
* });
|
|
1584
|
+
* var normalBuffer = Buffer.createVertexBuffer({
|
|
1585
|
+
* context : context,
|
|
1586
|
+
* sizeInBytes : 12,
|
|
1587
|
+
* usage : BufferUsage.STATIC_DRAW
|
|
1588
|
+
* });
|
|
1589
|
+
* var attributes = [
|
|
1590
|
+
* {
|
|
1591
|
+
* index : 0,
|
|
1592
|
+
* vertexBuffer : positionBuffer,
|
|
1593
|
+
* componentsPerAttribute : 3,
|
|
1594
|
+
* componentDatatype : ComponentDatatype.FLOAT
|
|
1595
|
+
* },
|
|
1596
|
+
* {
|
|
1597
|
+
* index : 1,
|
|
1598
|
+
* vertexBuffer : normalBuffer,
|
|
1599
|
+
* componentsPerAttribute : 3,
|
|
1600
|
+
* componentDatatype : ComponentDatatype.FLOAT
|
|
1601
|
+
* }
|
|
1602
|
+
* ];
|
|
1603
|
+
* var va = new VertexArray({
|
|
1604
|
+
* context : context,
|
|
1605
|
+
* attributes : attributes
|
|
1606
|
+
* });
|
|
1607
|
+
*
|
|
1608
|
+
* @example
|
|
1609
|
+
* // Example 3. Creates the same vertex layout as Example 2 using a single
|
|
1610
|
+
* // vertex buffer, instead of two.
|
|
1611
|
+
* var buffer = Buffer.createVertexBuffer({
|
|
1612
|
+
* context : context,
|
|
1613
|
+
* sizeInBytes : 24,
|
|
1614
|
+
* usage : BufferUsage.STATIC_DRAW
|
|
1615
|
+
* });
|
|
1616
|
+
* var attributes = [
|
|
1617
|
+
* {
|
|
1618
|
+
* vertexBuffer : buffer,
|
|
1619
|
+
* componentsPerAttribute : 3,
|
|
1620
|
+
* componentDatatype : ComponentDatatype.FLOAT,
|
|
1621
|
+
* offsetInBytes : 0,
|
|
1622
|
+
* strideInBytes : 24
|
|
1623
|
+
* },
|
|
1624
|
+
* {
|
|
1625
|
+
* vertexBuffer : buffer,
|
|
1626
|
+
* componentsPerAttribute : 3,
|
|
1627
|
+
* componentDatatype : ComponentDatatype.FLOAT,
|
|
1628
|
+
* normalize : true,
|
|
1629
|
+
* offsetInBytes : 12,
|
|
1630
|
+
* strideInBytes : 24
|
|
1631
|
+
* }
|
|
1632
|
+
* ];
|
|
1633
|
+
* var va = new VertexArray({
|
|
1634
|
+
* context : context,
|
|
1635
|
+
* attributes : attributes
|
|
1636
|
+
* });
|
|
1637
|
+
*
|
|
1638
|
+
* @see Buffer#createVertexBuffer
|
|
1639
|
+
* @see Buffer#createIndexBuffer
|
|
1640
|
+
* @see Context#draw
|
|
1641
|
+
*
|
|
1642
|
+
* @private
|
|
1643
|
+
*/
|
|
1644
|
+
export class VertexArray {
|
|
1645
|
+
constructor(options: {
|
|
1646
|
+
/**
|
|
1647
|
+
* The context in which the VertexArray gets created.
|
|
1648
|
+
*/
|
|
1649
|
+
context: Context
|
|
1650
|
+
/**
|
|
1651
|
+
* An array of attributes.
|
|
1652
|
+
*/
|
|
1653
|
+
attributes: VertexArrayAttribute[]
|
|
1654
|
+
/**
|
|
1655
|
+
* An optional index buffer.
|
|
1656
|
+
*/
|
|
1657
|
+
indexBuffer: IndexBuffer
|
|
1658
|
+
})
|
|
1659
|
+
|
|
1660
|
+
/**
|
|
1661
|
+
* @readonly
|
|
1662
|
+
*/
|
|
1663
|
+
numberOfAttributes: number
|
|
1664
|
+
/**
|
|
1665
|
+
* @readonly
|
|
1666
|
+
*/
|
|
1667
|
+
numberOfVertices: number
|
|
1668
|
+
/**
|
|
1669
|
+
* @readonly
|
|
1670
|
+
*/
|
|
1671
|
+
indexBuffer: Buffer
|
|
1672
|
+
|
|
1673
|
+
_bind: () => void
|
|
1674
|
+
_unBind: () => void
|
|
1675
|
+
isDestroyed: () => boolean
|
|
1676
|
+
destroy: () => void
|
|
1677
|
+
/**
|
|
1678
|
+
* Creates a vertex array from a geometry. A geometry contains vertex attributes and optional index data
|
|
1679
|
+
* in system memory, whereas a vertex array contains vertex buffers and an optional index buffer in WebGL
|
|
1680
|
+
* memory for use with rendering.
|
|
1681
|
+
* <br /><br />
|
|
1682
|
+
* The <code>geometry</code> argument should use the standard layout like the geometry returned by {@link BoxGeometry}.
|
|
1683
|
+
* <br /><br />
|
|
1684
|
+
* <code>options</code> can have four properties:
|
|
1685
|
+
* <ul>
|
|
1686
|
+
* <li><code>geometry</code>: The source geometry containing data used to create the vertex array.</li>
|
|
1687
|
+
* <li><code>attributeLocations</code>: An object that maps geometry attribute names to vertex shader attribute locations.</li>
|
|
1688
|
+
* <li><code>bufferUsage</code>: The expected usage pattern of the vertex array's buffers. On some WebGL implementations, this can significantly affect performance. See {@link BufferUsage}. Default: <code>BufferUsage.DYNAMIC_DRAW</code>.</li>
|
|
1689
|
+
* <li><code>interleave</code>: Determines if all attributes are interleaved in a single vertex buffer or if each attribute is stored in a separate vertex buffer. Default: <code>false</code>.</li>
|
|
1690
|
+
* </ul>
|
|
1691
|
+
* <br />
|
|
1692
|
+
* If <code>options</code> is not specified or the <code>geometry</code> contains no data, the returned vertex array is empty.
|
|
1693
|
+
*
|
|
1694
|
+
* @param {Object} options An object defining the geometry, attribute indices, buffer usage, and vertex layout used to create the vertex array.
|
|
1695
|
+
*
|
|
1696
|
+
* @exception {RuntimeError} Each attribute list must have the same number of vertices.
|
|
1697
|
+
* @exception {DeveloperError} The geometry must have zero or one index lists.
|
|
1698
|
+
* @exception {DeveloperError} Index n is used by more than one attribute.
|
|
1699
|
+
*
|
|
1700
|
+
*
|
|
1701
|
+
* @example
|
|
1702
|
+
* // Example 1. Creates a vertex array for rendering a box. The default dynamic draw
|
|
1703
|
+
* // usage is used for the created vertex and index buffer. The attributes are not
|
|
1704
|
+
* // interleaved by default.
|
|
1705
|
+
* var geometry = new BoxGeometry();
|
|
1706
|
+
* var va = VertexArray.fromGeometry({
|
|
1707
|
+
* context : context,
|
|
1708
|
+
* geometry : geometry,
|
|
1709
|
+
* attributeLocations : GeometryPipeline.createAttributeLocations(geometry),
|
|
1710
|
+
* });
|
|
1711
|
+
*
|
|
1712
|
+
* @example
|
|
1713
|
+
* // Example 2. Creates a vertex array with interleaved attributes in a
|
|
1714
|
+
* // single vertex buffer. The vertex and index buffer have static draw usage.
|
|
1715
|
+
* var va = VertexArray.fromGeometry({
|
|
1716
|
+
* context : context,
|
|
1717
|
+
* geometry : geometry,
|
|
1718
|
+
* attributeLocations : GeometryPipeline.createAttributeLocations(geometry),
|
|
1719
|
+
* bufferUsage : BufferUsage.STATIC_DRAW,
|
|
1720
|
+
* interleave : true
|
|
1721
|
+
* });
|
|
1722
|
+
*
|
|
1723
|
+
* @example
|
|
1724
|
+
* // Example 3. When the caller destroys the vertex array, it also destroys the
|
|
1725
|
+
* // attached vertex buffer(s) and index buffer.
|
|
1726
|
+
* va = va.destroy();
|
|
1727
|
+
*
|
|
1728
|
+
* @see Buffer#createVertexBuffer
|
|
1729
|
+
* @see Buffer#createIndexBuffer
|
|
1730
|
+
* @see GeometryPipeline.createAttributeLocations
|
|
1731
|
+
* @see ShaderProgram
|
|
1732
|
+
*/
|
|
1733
|
+
static fromGeometry: (options: {
|
|
1734
|
+
context: Context
|
|
1735
|
+
geometry: Geometry
|
|
1736
|
+
attributeLocations: { [key: string]: number }
|
|
1737
|
+
bufferUsage?: BufferUsage
|
|
1738
|
+
interleave?: boolean
|
|
1739
|
+
vertexArrayAttributes?: VertexArrayAttribute[]
|
|
1740
|
+
}) => VertexArray
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* An object containing various inputs that will be combined to form a final GLSL shader string.
|
|
1745
|
+
*
|
|
1746
|
+
* @param {Object} [options] Object with the following properties:
|
|
1747
|
+
* @param {String[]} [options.sources] An array of strings to combine containing GLSL code for the shader.
|
|
1748
|
+
* @param {String[]} [options.defines] An array of strings containing GLSL identifiers to <code>#define</code>.
|
|
1749
|
+
* @param {String} [options.pickColorQualifier] The GLSL qualifier, <code>uniform</code> or <code>varying</code>, for the input <code>czm_pickColor</code>. When defined, a pick fragment shader is generated.
|
|
1750
|
+
* @param {Boolean} [options.includeBuiltIns=true] If true, referenced built-in functions will be included with the combined shader. Set to false if this shader will become a source in another shader, to avoid duplicating functions.
|
|
1751
|
+
*
|
|
1752
|
+
* @exception {DeveloperError} options.pickColorQualifier must be 'uniform' or 'varying'.
|
|
1753
|
+
*
|
|
1754
|
+
* @example
|
|
1755
|
+
* // 1. Prepend #defines to a shader
|
|
1756
|
+
* var source = new Cesium.ShaderSource({
|
|
1757
|
+
* defines : ['WHITE'],
|
|
1758
|
+
* sources : ['void main() { \n#ifdef WHITE\n gl_FragColor = vec4(1.0); \n#else\n gl_FragColor = vec4(0.0); \n#endif\n }']
|
|
1759
|
+
* });
|
|
1760
|
+
*
|
|
1761
|
+
* // 2. Modify a fragment shader for picking
|
|
1762
|
+
* var source = new Cesium.ShaderSource({
|
|
1763
|
+
* sources : ['void main() { gl_FragColor = vec4(1.0); }'],
|
|
1764
|
+
* pickColorQualifier : 'uniform'
|
|
1765
|
+
* });
|
|
1766
|
+
*
|
|
1767
|
+
* @private
|
|
1768
|
+
*/
|
|
1769
|
+
export class ShaderSource {
|
|
1770
|
+
|
|
1771
|
+
constructor(options?: {
|
|
1772
|
+
defines?: string[]
|
|
1773
|
+
sources?: string[]
|
|
1774
|
+
pickColorQualifier?: string
|
|
1775
|
+
includeBuiltIns?: boolean
|
|
1776
|
+
})
|
|
1777
|
+
|
|
1778
|
+
clone(): ShaderSource
|
|
1779
|
+
|
|
1780
|
+
/**
|
|
1781
|
+
* Create a single string containing the full, combined vertex shader with all dependencies and defines.
|
|
1782
|
+
*
|
|
1783
|
+
* @param {Context} context The current rendering context
|
|
1784
|
+
*
|
|
1785
|
+
* @returns {String} The combined shader string.
|
|
1786
|
+
*/
|
|
1787
|
+
createCombinedVertexShader(context: Context): String
|
|
1788
|
+
|
|
1789
|
+
/**
|
|
1790
|
+
* Create a single string containing the full, combined fragment shader with all dependencies and defines.
|
|
1791
|
+
*
|
|
1792
|
+
* @param {Context} context The current rendering context
|
|
1793
|
+
*
|
|
1794
|
+
* @returns {String} The combined shader string.
|
|
1795
|
+
*/
|
|
1796
|
+
createCombinedFragmentShader(context: Context): string
|
|
1797
|
+
|
|
1798
|
+
static replaceMain(source, renamedMain): string
|
|
1799
|
+
/**
|
|
1800
|
+
* For ShaderProgram testing
|
|
1801
|
+
* @private
|
|
1802
|
+
*/
|
|
1803
|
+
static _czmBuiltinsAndUniforms: {};
|
|
1804
|
+
|
|
1805
|
+
static createPickVertexShaderSource(vertexShaderSource: string): string
|
|
1806
|
+
|
|
1807
|
+
static createPickFragmentShaderSource(
|
|
1808
|
+
fragmentShaderSource: string,
|
|
1809
|
+
pickColorQualifier: string
|
|
1810
|
+
): string
|
|
1811
|
+
|
|
1812
|
+
static findVarying: (shaderSource: ShaderSource, names: string[]) => string
|
|
1813
|
+
|
|
1814
|
+
static findNormalVarying: (shaderSource: ShaderSource) => string
|
|
1815
|
+
|
|
1816
|
+
static findPositionVarying: (shaderSource: ShaderSource) => string
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
/**
|
|
1820
|
+
* @private
|
|
1821
|
+
*/
|
|
1822
|
+
export class ShaderProgram {
|
|
1823
|
+
constructor(options: {
|
|
1824
|
+
vertexShaderText: string
|
|
1825
|
+
fragmentShaderText: string
|
|
1826
|
+
attributeLocations: { [key: string]: number }
|
|
1827
|
+
logShaderCompilation?: boolean
|
|
1828
|
+
debugShaders?: boolean
|
|
1829
|
+
vertexShaderSource?: ShaderSource
|
|
1830
|
+
duplicateUniformNames?: { [key: string]: string }
|
|
1831
|
+
fragmentShaderSource?: ShaderSource
|
|
1832
|
+
})
|
|
1833
|
+
maximumTextureUnitIndex: 1
|
|
1834
|
+
_attributeLocations: { [key: string]: number }
|
|
1835
|
+
_automaticUniforms: []
|
|
1836
|
+
_duplicateUniformNames: {}
|
|
1837
|
+
_fragmentShaderSource: ShaderSource
|
|
1838
|
+
_fragmentShaderText: String
|
|
1839
|
+
_gl: WebGLRenderingContext | WebGL2RenderingContext
|
|
1840
|
+
_logShaderCompilation: boolean
|
|
1841
|
+
_manualUniforms: (IUniform | IUniformArray)[]
|
|
1842
|
+
_numberOfVertexAttributes: number
|
|
1843
|
+
_program: WebGLProgram
|
|
1844
|
+
_uniforms: (IUniform | IUniformArray)[]
|
|
1845
|
+
_uniformsByName: {
|
|
1846
|
+
[key: string]: (IUniform | IUniformArray)
|
|
1847
|
+
}
|
|
1848
|
+
_vertexAttributes: {
|
|
1849
|
+
index: number
|
|
1850
|
+
name: string
|
|
1851
|
+
type: number
|
|
1852
|
+
}[]
|
|
1853
|
+
_vertexShaderSource: ShaderSource
|
|
1854
|
+
_vertexShaderText: string
|
|
1855
|
+
/**
|
|
1856
|
+
*
|
|
1857
|
+
*/
|
|
1858
|
+
static fromCache: (options: {
|
|
1859
|
+
/**
|
|
1860
|
+
* The GLSL source for the vertex shader.
|
|
1861
|
+
*/
|
|
1862
|
+
vertexShaderSource: String | ShaderSource
|
|
1863
|
+
/**
|
|
1864
|
+
* The GLSL source for the fragment shader.
|
|
1865
|
+
*/
|
|
1866
|
+
fragmentShaderSource: String | ShaderSource
|
|
1867
|
+
/**
|
|
1868
|
+
* Indices for the attribute inputs to the vertex shader.
|
|
1869
|
+
*/
|
|
1870
|
+
attributeLocations: { [key: string]: number }
|
|
1871
|
+
}) => ShaderProgram
|
|
1872
|
+
|
|
1873
|
+
|
|
1874
|
+
static replaceCache: (options: {
|
|
1875
|
+
/**
|
|
1876
|
+
* The shader program that is being reassigned.
|
|
1877
|
+
*/
|
|
1878
|
+
shaderProgram: ShaderProgram;
|
|
1879
|
+
/**
|
|
1880
|
+
* The GLSL source for the vertex shader.
|
|
1881
|
+
*/
|
|
1882
|
+
vertexShaderSource: String | ShaderSource
|
|
1883
|
+
/**
|
|
1884
|
+
* The GLSL source for the fragment shader.
|
|
1885
|
+
*/
|
|
1886
|
+
fragmentShaderSource: String | ShaderSource
|
|
1887
|
+
/**
|
|
1888
|
+
* Indices for the attribute inputs to the vertex shader.
|
|
1889
|
+
*/
|
|
1890
|
+
attributeLocations: { [key: string]: number }
|
|
1891
|
+
|
|
1892
|
+
}) => ShaderProgram
|
|
1893
|
+
|
|
1894
|
+
/**
|
|
1895
|
+
* GLSL source for the shader program's vertex shader.
|
|
1896
|
+
* @memberof ShaderProgram.prototype
|
|
1897
|
+
*
|
|
1898
|
+
* @type {ShaderSource}
|
|
1899
|
+
* @readonly
|
|
1900
|
+
*/
|
|
1901
|
+
vertexShaderSource: ShaderSource
|
|
1902
|
+
/**
|
|
1903
|
+
* GLSL source for the shader program's fragment shader.
|
|
1904
|
+
* @memberof ShaderProgram.prototype
|
|
1905
|
+
*
|
|
1906
|
+
* @type {ShaderSource}
|
|
1907
|
+
* @readonly
|
|
1908
|
+
*/
|
|
1909
|
+
fragmentShaderSource: ShaderSource
|
|
1910
|
+
/**
|
|
1911
|
+
* @readonly
|
|
1912
|
+
*/
|
|
1913
|
+
vertexAttributes: {
|
|
1914
|
+
[key: string]: {
|
|
1915
|
+
name: string
|
|
1916
|
+
type: number
|
|
1917
|
+
index: number
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
/**
|
|
1921
|
+
* @readonly
|
|
1922
|
+
*/
|
|
1923
|
+
numberOfVertexAttributes: number
|
|
1924
|
+
/**
|
|
1925
|
+
* @readonly
|
|
1926
|
+
*/
|
|
1927
|
+
allUniforms: string[]
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
export interface IUniform {
|
|
1931
|
+
name: string
|
|
1932
|
+
textureUnitIndex?: number
|
|
1933
|
+
value: number | boolean | Color | Cartesian2 | Cartesian3 | Cartesian4 | Matrix2 | Matrix3 | Matrix4 | Texture
|
|
1934
|
+
_gl: WebGLRenderingContext | WebGL2RenderingContext
|
|
1935
|
+
_location: WebGLUniformLocation
|
|
1936
|
+
_value: number | boolean | Color | Cartesian2 | Cartesian3 | Cartesian4 | Matrix2 | Matrix3 | Matrix4 | Texture
|
|
1937
|
+
}
|
|
1938
|
+
export interface IUniformArray {
|
|
1939
|
+
name: string
|
|
1940
|
+
value: (number | boolean | boolean[] | Color | Cartesian2 | Cartesian3 | Cartesian4 | Matrix2 | Matrix3 | Matrix4)[]
|
|
1941
|
+
_gl: WebGLRenderingContext | WebGL2RenderingContext
|
|
1942
|
+
_location: WebGLUniformLocation
|
|
1943
|
+
_value: (number | number[] | boolean | boolean[] | Color | Cartesian2 | Cartesian3 | Cartesian4 | Matrix2 | Matrix3 | Matrix4)[]
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
/**
|
|
1947
|
+
* @private
|
|
1948
|
+
* @constructor
|
|
1949
|
+
*/
|
|
1950
|
+
export function createUniform(gl: WebGLRenderingContext | WebGL2RenderingContext, activeUniform: WebGLActiveInfo, uniformName: string, location: WebGLUniformLocation): IUniform
|
|
1951
|
+
|
|
1952
|
+
/**
|
|
1953
|
+
* @private
|
|
1954
|
+
* @constructor
|
|
1955
|
+
*/
|
|
1956
|
+
export function createUniformArray(gl: WebGLRenderingContext | WebGL2RenderingContext, activeUniform: WebGLActiveInfo, uniformName: string, locations: WebGLUniformLocation[]): IUniformArray
|
|
1957
|
+
/**
|
|
1958
|
+
* @private
|
|
1959
|
+
*/
|
|
1960
|
+
export enum TextureWrap {
|
|
1961
|
+
REPEAT = 10497,
|
|
1962
|
+
CLAMP_TO_EDGE = 33071,
|
|
1963
|
+
MIRRORED_REPEAT = 33648
|
|
1964
|
+
|
|
1965
|
+
// CLAMP_TO_EDGE = WebGLConstants.CLAMP_TO_EDGE,
|
|
1966
|
+
// REPEAT = WebGLConstants.REPEAT,
|
|
1967
|
+
// MIRRORED_REPEAT = WebGLConstants.MIRRORED_REPEAT
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
/**
|
|
1971
|
+
* @private
|
|
1972
|
+
*/
|
|
1973
|
+
export class Sampler {
|
|
1974
|
+
constructor(options: {
|
|
1975
|
+
wrapS: TextureWrap
|
|
1976
|
+
wrapT: TextureWrap
|
|
1977
|
+
minificationFilter: TextureMinificationFilter
|
|
1978
|
+
magnificationFilter: TextureMagnificationFilter
|
|
1979
|
+
maximumAnisotropy?: number
|
|
1980
|
+
})
|
|
1981
|
+
/**
|
|
1982
|
+
* @readonly
|
|
1983
|
+
*/
|
|
1984
|
+
wrapS: TextureWrap
|
|
1985
|
+
/**
|
|
1986
|
+
* @readonly
|
|
1987
|
+
*/
|
|
1988
|
+
wrapT: TextureWrap
|
|
1989
|
+
/**
|
|
1990
|
+
* @readonly
|
|
1991
|
+
*/
|
|
1992
|
+
minificationFilter: TextureMinificationFilter
|
|
1993
|
+
|
|
1994
|
+
/**
|
|
1995
|
+
* @readonly
|
|
1996
|
+
*/
|
|
1997
|
+
magnificationFilter: TextureMagnificationFilter
|
|
1998
|
+
/**
|
|
1999
|
+
* @readonly
|
|
2000
|
+
*/
|
|
2001
|
+
maximumAnisotropy: number
|
|
2002
|
+
|
|
2003
|
+
static equals(left: Sampler, right: Sampler): boolean
|
|
2004
|
+
|
|
2005
|
+
static NEAREST: Sampler
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
|
|
2009
|
+
/**
|
|
2010
|
+
* @private
|
|
2011
|
+
*/
|
|
2012
|
+
enum MipmapHint {
|
|
2013
|
+
|
|
2014
|
+
DONT_CARE = 4352,
|
|
2015
|
+
FASTEST = 4353,
|
|
2016
|
+
NICEST = 4354,
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* @private
|
|
2020
|
+
*/
|
|
2021
|
+
export class Texture {
|
|
2022
|
+
constructor(options: {
|
|
2023
|
+
context: Context
|
|
2024
|
+
width: number
|
|
2025
|
+
height: number
|
|
2026
|
+
source?: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageData | {
|
|
2027
|
+
arrayBufferView: ArrayBufferView
|
|
2028
|
+
width: number
|
|
2029
|
+
height: number
|
|
2030
|
+
mipLevels?: ArrayBufferView[]
|
|
2031
|
+
} | {
|
|
2032
|
+
framebuffer: Framebuffer
|
|
2033
|
+
xOffset: number
|
|
2034
|
+
yOffset: number
|
|
2035
|
+
width: number
|
|
2036
|
+
height: number
|
|
2037
|
+
}
|
|
2038
|
+
pixelFormat?: PixelFormat
|
|
2039
|
+
pixelDatatype?: PixelDatatype
|
|
2040
|
+
preMultiplyAlpha?: boolean
|
|
2041
|
+
sampler?: Sampler
|
|
2042
|
+
})
|
|
2043
|
+
|
|
2044
|
+
|
|
2045
|
+
/**
|
|
2046
|
+
* This function is identical to using the Texture constructor except that it can be
|
|
2047
|
+
* replaced with a mock/spy in tests.
|
|
2048
|
+
* @private
|
|
2049
|
+
*/
|
|
2050
|
+
static create(options: {
|
|
2051
|
+
context: Context
|
|
2052
|
+
width: number
|
|
2053
|
+
height: number
|
|
2054
|
+
source?: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement
|
|
2055
|
+
pixelFormat?: PixelFormat
|
|
2056
|
+
pixelDatatype?: PixelDatatype
|
|
2057
|
+
preMultiplyAlpha?: boolean
|
|
2058
|
+
sampler?: Sampler
|
|
2059
|
+
}): Texture
|
|
2060
|
+
|
|
2061
|
+
/**
|
|
2062
|
+
* Creates a texture, and copies a subimage of the framebuffer to it. When called without arguments,
|
|
2063
|
+
* the texture is the same width and height as the framebuffer and contains its contents.
|
|
2064
|
+
*
|
|
2065
|
+
* @param {Object} options Object with the following properties:
|
|
2066
|
+
* @param {Context} options.context The context in which the Texture gets created.
|
|
2067
|
+
* @param {PixelFormat} [options.pixelFormat=PixelFormat.RGB] The texture's internal pixel format.
|
|
2068
|
+
* @param {Number} [options.framebufferXOffset=0] An offset in the x direction in the framebuffer where copying begins from.
|
|
2069
|
+
* @param {Number} [options.framebufferYOffset=0] An offset in the y direction in the framebuffer where copying begins from.
|
|
2070
|
+
* @param {Number} [options.width=canvas.clientWidth] The width of the texture in texels.
|
|
2071
|
+
* @param {Number} [options.height=canvas.clientHeight] The height of the texture in texels.
|
|
2072
|
+
* @param {Framebuffer} [options.framebuffer=defaultFramebuffer] The framebuffer from which to create the texture. If this
|
|
2073
|
+
* parameter is not specified, the default framebuffer is used.
|
|
2074
|
+
* @returns {Texture} A texture with contents from the framebuffer.
|
|
2075
|
+
*
|
|
2076
|
+
* @exception {DeveloperError} Invalid pixelFormat.
|
|
2077
|
+
* @exception {DeveloperError} pixelFormat cannot be DEPTH_COMPONENT, DEPTH_STENCIL or a compressed format.
|
|
2078
|
+
* @exception {DeveloperError} framebufferXOffset must be greater than or equal to zero.
|
|
2079
|
+
* @exception {DeveloperError} framebufferYOffset must be greater than or equal to zero.
|
|
2080
|
+
* @exception {DeveloperError} framebufferXOffset + width must be less than or equal to canvas.clientWidth.
|
|
2081
|
+
* @exception {DeveloperError} framebufferYOffset + height must be less than or equal to canvas.clientHeight.
|
|
2082
|
+
*
|
|
2083
|
+
*
|
|
2084
|
+
* @example
|
|
2085
|
+
* // Create a texture with the contents of the framebuffer.
|
|
2086
|
+
* var t = Texture.fromFramebuffer({
|
|
2087
|
+
* context : context
|
|
2088
|
+
* });
|
|
2089
|
+
*
|
|
2090
|
+
* @see Sampler
|
|
2091
|
+
*
|
|
2092
|
+
* @private
|
|
2093
|
+
*/
|
|
2094
|
+
fromFramebuffer(options: {
|
|
2095
|
+
context: Context
|
|
2096
|
+
pixelFormat?: PixelFormat
|
|
2097
|
+
framebufferXOffset?: number
|
|
2098
|
+
framebufferYOffset?: number
|
|
2099
|
+
width?: number
|
|
2100
|
+
height?: number
|
|
2101
|
+
framebuffer?: Framebuffer
|
|
2102
|
+
}): Texture
|
|
2103
|
+
|
|
2104
|
+
/**
|
|
2105
|
+
* A unique id for the texture
|
|
2106
|
+
* @memberof Texture.prototype
|
|
2107
|
+
* @type {String}
|
|
2108
|
+
* @readonly
|
|
2109
|
+
* @private
|
|
2110
|
+
*/
|
|
2111
|
+
id: string
|
|
2112
|
+
/**
|
|
2113
|
+
* The sampler to use when sampling this texture.
|
|
2114
|
+
* Create a sampler by calling {@link Sampler}. If this
|
|
2115
|
+
* parameter is not specified, a default sampler is used. The default sampler clamps texture
|
|
2116
|
+
* coordinates in both directions, uses linear filtering for both magnification and minification,
|
|
2117
|
+
* and uses a maximum anisotropy of 1.0.
|
|
2118
|
+
* @memberof Texture.prototype
|
|
2119
|
+
* @type {Object}
|
|
2120
|
+
*/
|
|
2121
|
+
sampler: Object | Sampler
|
|
2122
|
+
/**
|
|
2123
|
+
* @readonly
|
|
2124
|
+
*/
|
|
2125
|
+
pixelFormat: PixelFormat
|
|
2126
|
+
/**
|
|
2127
|
+
* @readonly
|
|
2128
|
+
*/
|
|
2129
|
+
pixelDatatype: PixelDatatype
|
|
2130
|
+
/**
|
|
2131
|
+
* @readonly
|
|
2132
|
+
*/
|
|
2133
|
+
dimensions: Cartesian2
|
|
2134
|
+
/**
|
|
2135
|
+
* @readonly
|
|
2136
|
+
*/
|
|
2137
|
+
preMultiplyAlpha: boolean
|
|
2138
|
+
|
|
2139
|
+
/**
|
|
2140
|
+
* @readonly
|
|
2141
|
+
*/
|
|
2142
|
+
flipY: boolean
|
|
2143
|
+
/**
|
|
2144
|
+
* @readonly
|
|
2145
|
+
*/
|
|
2146
|
+
width: number
|
|
2147
|
+
/**
|
|
2148
|
+
* @readonly
|
|
2149
|
+
*/
|
|
2150
|
+
height: number
|
|
2151
|
+
/**
|
|
2152
|
+
* @readonly
|
|
2153
|
+
*/
|
|
2154
|
+
sizeInBytes: number
|
|
2155
|
+
/**
|
|
2156
|
+
* @readonly
|
|
2157
|
+
*/
|
|
2158
|
+
_target: number
|
|
2159
|
+
|
|
2160
|
+
/**
|
|
2161
|
+
* Copy new image data into this texture, from a source {@link ImageData}, {@link HTMLImageElement}, {@link HTMLCanvasElement}, or {@link HTMLVideoElement}.
|
|
2162
|
+
* or an object with width, height, and arrayBufferView properties.
|
|
2163
|
+
*
|
|
2164
|
+
* @param {Object} source The source {@link ImageData}, {@link HTMLImageElement}, {@link HTMLCanvasElement}, or {@link HTMLVideoElement},
|
|
2165
|
+
* or an object with width, height, and arrayBufferView properties.
|
|
2166
|
+
* @param {Number} [xOffset=0] The offset in the x direction within the texture to copy into.
|
|
2167
|
+
* @param {Number} [yOffset=0] The offset in the y direction within the texture to copy into.
|
|
2168
|
+
*
|
|
2169
|
+
* @exception {DeveloperError} Cannot call copyFrom when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.
|
|
2170
|
+
* @exception {DeveloperError} Cannot call copyFrom with a compressed texture pixel format.
|
|
2171
|
+
* @exception {DeveloperError} xOffset must be greater than or equal to zero.
|
|
2172
|
+
* @exception {DeveloperError} yOffset must be greater than or equal to zero.
|
|
2173
|
+
* @exception {DeveloperError} xOffset + source.width must be less than or equal to width.
|
|
2174
|
+
* @exception {DeveloperError} yOffset + source.height must be less than or equal to height.
|
|
2175
|
+
* @exception {DeveloperError} This texture was destroyed, i.e., destroy() was called.
|
|
2176
|
+
*
|
|
2177
|
+
* @example
|
|
2178
|
+
* texture.copyFrom({
|
|
2179
|
+
* width : 1,
|
|
2180
|
+
* height : 1,
|
|
2181
|
+
* arrayBufferView : new Uint8Array([255, 0, 0, 255])
|
|
2182
|
+
* });
|
|
2183
|
+
*/
|
|
2184
|
+
copyFrom(source: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, xOffset?: number, yOffset?: number): void
|
|
2185
|
+
|
|
2186
|
+
/**
|
|
2187
|
+
* @param {Number} [xOffset=0] The offset in the x direction within the texture to copy into.
|
|
2188
|
+
* @param {Number} [yOffset=0] The offset in the y direction within the texture to copy into.
|
|
2189
|
+
* @param {Number} [framebufferXOffset=0] optional
|
|
2190
|
+
* @param {Number} [framebufferYOffset=0] optional
|
|
2191
|
+
* @param {Number} [width=width] optional
|
|
2192
|
+
* @param {Number} [height=height] optional
|
|
2193
|
+
*
|
|
2194
|
+
* @exception {DeveloperError} Cannot call copyFromFramebuffer when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.
|
|
2195
|
+
* @exception {DeveloperError} Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.
|
|
2196
|
+
* @exception {DeveloperError} Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.
|
|
2197
|
+
* @exception {DeveloperError} Cannot call copyFrom with a compressed texture pixel format.
|
|
2198
|
+
* @exception {DeveloperError} This texture was destroyed, i.e., destroy() was called.
|
|
2199
|
+
* @exception {DeveloperError} xOffset must be greater than or equal to zero.
|
|
2200
|
+
* @exception {DeveloperError} yOffset must be greater than or equal to zero.
|
|
2201
|
+
* @exception {DeveloperError} framebufferXOffset must be greater than or equal to zero.
|
|
2202
|
+
* @exception {DeveloperError} framebufferYOffset must be greater than or equal to zero.
|
|
2203
|
+
* @exception {DeveloperError} xOffset + width must be less than or equal to width.
|
|
2204
|
+
* @exception {DeveloperError} yOffset + height must be less than or equal to height.
|
|
2205
|
+
*/
|
|
2206
|
+
copyFromFramebuffer(
|
|
2207
|
+
xOffset: number,
|
|
2208
|
+
yOffset: number,
|
|
2209
|
+
framebufferXOffset: number,
|
|
2210
|
+
framebufferYOffset: number,
|
|
2211
|
+
width: number,
|
|
2212
|
+
height: number
|
|
2213
|
+
): void
|
|
2214
|
+
|
|
2215
|
+
/**
|
|
2216
|
+
* @param {MipmapHint} [hint=MipmapHint.DONT_CARE] optional.
|
|
2217
|
+
*
|
|
2218
|
+
* @exception {DeveloperError} Cannot call generateMipmap when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.
|
|
2219
|
+
* @exception {DeveloperError} Cannot call generateMipmap when the texture pixel format is a compressed format.
|
|
2220
|
+
* @exception {DeveloperError} hint is invalid.
|
|
2221
|
+
* @exception {DeveloperError} This texture's width must be a power of two to call generateMipmap().
|
|
2222
|
+
* @exception {DeveloperError} This texture's height must be a power of two to call generateMipmap().
|
|
2223
|
+
* @exception {DeveloperError} This texture was destroyed, i.e., destroy() was called.
|
|
2224
|
+
*/
|
|
2225
|
+
generateMipmap(hint: MipmapHint): void
|
|
2226
|
+
|
|
2227
|
+
isDestroyed(): boolean
|
|
2228
|
+
|
|
2229
|
+
destroy(): any
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
/**
|
|
2233
|
+
* @private
|
|
2234
|
+
*/
|
|
2235
|
+
export enum RenderbufferFormat {
|
|
2236
|
+
|
|
2237
|
+
RGBA4 = 32854,
|
|
2238
|
+
RGB5_A1 = 32855,
|
|
2239
|
+
RGB565 = 36194,
|
|
2240
|
+
DEPTH_COMPONENT16 = 33189,
|
|
2241
|
+
STENCIL_INDEX = 6401,
|
|
2242
|
+
STENCIL_INDEX8 = 36168,
|
|
2243
|
+
DEPTH_STENCIL = 34041,
|
|
2244
|
+
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
/**
|
|
2248
|
+
* @private
|
|
2249
|
+
*/
|
|
2250
|
+
export class Renderbuffer {
|
|
2251
|
+
constructor(options: {
|
|
2252
|
+
context: Context
|
|
2253
|
+
format: RenderbufferFormat
|
|
2254
|
+
width: number
|
|
2255
|
+
height: number
|
|
2256
|
+
})
|
|
2257
|
+
_gl: WebGL2RenderingContext | WebGLRenderingContext
|
|
2258
|
+
_format: RenderbufferFormat
|
|
2259
|
+
_width: number
|
|
2260
|
+
_height: number
|
|
2261
|
+
_renderbuffer: WebGLRenderbuffer
|
|
2262
|
+
/**
|
|
2263
|
+
* @readonly
|
|
2264
|
+
*/
|
|
2265
|
+
format: RenderbufferFormat
|
|
2266
|
+
/**
|
|
2267
|
+
* @readonly
|
|
2268
|
+
*/
|
|
2269
|
+
width: number
|
|
2270
|
+
/**
|
|
2271
|
+
* @readonly
|
|
2272
|
+
*/
|
|
2273
|
+
height: number
|
|
2274
|
+
|
|
2275
|
+
_getRenderbuffer(): WebGLRenderbuffer
|
|
2276
|
+
|
|
2277
|
+
isDestroyed(): boolean
|
|
2278
|
+
|
|
2279
|
+
destroy(): void
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
/**
|
|
2283
|
+
* Creates a framebuffer with optional initial color, depth, and stencil attachments.
|
|
2284
|
+
* Framebuffers are used for render-to-texture effects; they allow us to render to
|
|
2285
|
+
* textures in one pass, and read from it in a later pass.
|
|
2286
|
+
*
|
|
2287
|
+
* @param {Object} options The initial framebuffer attachments as shown in the example below. <code>context</code> is required. The possible properties are <code>colorTextures</code>, <code>colorRenderbuffers</code>, <code>depthTexture</code>, <code>depthRenderbuffer</code>, <code>stencilRenderbuffer</code>, <code>depthStencilTexture</code>, and <code>depthStencilRenderbuffer</code>.
|
|
2288
|
+
*
|
|
2289
|
+
* @exception {DeveloperError} Cannot have both color texture and color renderbuffer attachments.
|
|
2290
|
+
* @exception {DeveloperError} Cannot have both a depth texture and depth renderbuffer attachment.
|
|
2291
|
+
* @exception {DeveloperError} Cannot have both a depth-stencil texture and depth-stencil renderbuffer attachment.
|
|
2292
|
+
* @exception {DeveloperError} Cannot have both a depth and depth-stencil renderbuffer.
|
|
2293
|
+
* @exception {DeveloperError} Cannot have both a stencil and depth-stencil renderbuffer.
|
|
2294
|
+
* @exception {DeveloperError} Cannot have both a depth and stencil renderbuffer.
|
|
2295
|
+
* @exception {DeveloperError} The color-texture pixel-format must be a color format.
|
|
2296
|
+
* @exception {DeveloperError} The depth-texture pixel-format must be DEPTH_COMPONENT.
|
|
2297
|
+
* @exception {DeveloperError} The depth-stencil-texture pixel-format must be DEPTH_STENCIL.
|
|
2298
|
+
* @exception {DeveloperError} The number of color attachments exceeds the number supported.
|
|
2299
|
+
* @exception {DeveloperError} The color-texture pixel datatype is HALF_FLOAT and the WebGL implementation does not support the EXT_color_buffer_half_float extension.
|
|
2300
|
+
* @exception {DeveloperError} The color-texture pixel datatype is FLOAT and the WebGL implementation does not support the EXT_color_buffer_float or WEBGL_color_buffer_float extensions.
|
|
2301
|
+
*
|
|
2302
|
+
* @example
|
|
2303
|
+
* // Create a framebuffer with color and depth texture attachments.
|
|
2304
|
+
* var width = context.canvas.clientWidth;
|
|
2305
|
+
* var height = context.canvas.clientHeight;
|
|
2306
|
+
* var framebuffer = new Framebuffer({
|
|
2307
|
+
* context : context,
|
|
2308
|
+
* colorTextures : [new Texture({
|
|
2309
|
+
* context : context,
|
|
2310
|
+
* width : width,
|
|
2311
|
+
* height : height,
|
|
2312
|
+
* pixelFormat : PixelFormat.RGBA
|
|
2313
|
+
* })],
|
|
2314
|
+
* depthTexture : new Texture({
|
|
2315
|
+
* context : context,
|
|
2316
|
+
* width : width,
|
|
2317
|
+
* height : height,
|
|
2318
|
+
* pixelFormat : PixelFormat.DEPTH_COMPONENT,
|
|
2319
|
+
* pixelDatatype : PixelDatatype.UNSIGNED_SHORT
|
|
2320
|
+
* })
|
|
2321
|
+
* });
|
|
2322
|
+
*
|
|
2323
|
+
* @private
|
|
2324
|
+
* @constructor
|
|
2325
|
+
*/
|
|
2326
|
+
export class Framebuffer {
|
|
2327
|
+
constructor(options: {
|
|
2328
|
+
context: Context
|
|
2329
|
+
colorTextures: Texture[]
|
|
2330
|
+
colorRenderbuffers?: Renderbuffer[]
|
|
2331
|
+
depthTexture: Texture
|
|
2332
|
+
depthRenderbuffer: Renderbuffer
|
|
2333
|
+
/**
|
|
2334
|
+
* @default true
|
|
2335
|
+
*/
|
|
2336
|
+
destroyAttachments?: boolean
|
|
2337
|
+
|
|
2338
|
+
depthStencilTexture?: Texture
|
|
2339
|
+
depthStencilRenderbuffer?: Renderbuffer
|
|
2340
|
+
})
|
|
2341
|
+
|
|
2342
|
+
/**
|
|
2343
|
+
* The status of the framebuffer. If the status is not WebGLConstants.FRAMEBUFFER_COMPLETE,
|
|
2344
|
+
* a {@link DeveloperError} will be thrown when attempting to render to the framebuffer.
|
|
2345
|
+
* @memberof Framebuffer.prototype
|
|
2346
|
+
* @type {Number}
|
|
2347
|
+
* @readonly
|
|
2348
|
+
*/
|
|
2349
|
+
status: number
|
|
2350
|
+
/**
|
|
2351
|
+
* @readonly
|
|
2352
|
+
*/
|
|
2353
|
+
numberOfColorAttachments: number
|
|
2354
|
+
/**
|
|
2355
|
+
* @readonly
|
|
2356
|
+
*/
|
|
2357
|
+
depthTexture: Texture
|
|
2358
|
+
/**
|
|
2359
|
+
* @readonly
|
|
2360
|
+
*/
|
|
2361
|
+
depthRenderbuffer: Renderbuffer
|
|
2362
|
+
/**
|
|
2363
|
+
* @readonly
|
|
2364
|
+
*/
|
|
2365
|
+
stencilRenderbuffer: Renderbuffer
|
|
2366
|
+
/**
|
|
2367
|
+
* @readonly
|
|
2368
|
+
*/
|
|
2369
|
+
depthStencilTexture: Texture
|
|
2370
|
+
/**
|
|
2371
|
+
* @readonly
|
|
2372
|
+
*/
|
|
2373
|
+
depthStencilRenderbuffer: Renderbuffer
|
|
2374
|
+
|
|
2375
|
+
/**
|
|
2376
|
+
* True if the framebuffer has a depth attachment. Depth attachments include
|
|
2377
|
+
* depth and depth-stencil textures, and depth and depth-stencil renderbuffers. When
|
|
2378
|
+
* rendering to a framebuffer, a depth attachment is required for the depth test to have effect.
|
|
2379
|
+
* @memberof Framebuffer.prototype
|
|
2380
|
+
* @type {Boolean}
|
|
2381
|
+
* @readonly
|
|
2382
|
+
*/
|
|
2383
|
+
hasDepthAttachment: boolean
|
|
2384
|
+
|
|
2385
|
+
_bind(): void
|
|
2386
|
+
|
|
2387
|
+
_unBind(): void
|
|
2388
|
+
|
|
2389
|
+
_getActiveColorAttachments(): void
|
|
2390
|
+
|
|
2391
|
+
getColorTexture(index): Texture
|
|
2392
|
+
getColorRenderbuffer(index): Renderbuffer
|
|
2393
|
+
isDestroyed(): boolean
|
|
2394
|
+
destroy(): any
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
/**
|
|
2398
|
+
* Represents a command to the renderer for drawing.
|
|
2399
|
+
*
|
|
2400
|
+
* @private
|
|
2401
|
+
*/
|
|
2402
|
+
export class DrawCommand {
|
|
2403
|
+
constructor(options: {
|
|
2404
|
+
modelMatrix: Matrix4
|
|
2405
|
+
vertexArray: VertexArray
|
|
2406
|
+
shaderProgram: ShaderProgram
|
|
2407
|
+
uniformMap: { [key: string]: () => (number | boolean | number[] | Cartesian2 | Cartesian3 | Cartesian4 | Color | Matrix2 | Matrix3 | Matrix4 | Texture | CubeMap) }
|
|
2408
|
+
renderState: RenderState
|
|
2409
|
+
|
|
2410
|
+
/**
|
|
2411
|
+
* @default PrimitiveType.TRIANGLES
|
|
2412
|
+
*/
|
|
2413
|
+
primitiveType?: PrimitiveType
|
|
2414
|
+
owner?: object
|
|
2415
|
+
instanceCount?: number
|
|
2416
|
+
framebuffer?: Framebuffer
|
|
2417
|
+
/**
|
|
2418
|
+
* @default false
|
|
2419
|
+
*/
|
|
2420
|
+
castShadows?: boolean
|
|
2421
|
+
/**
|
|
2422
|
+
* @default false
|
|
2423
|
+
*/
|
|
2424
|
+
receiveShadows?: boolean
|
|
2425
|
+
pickId: Object
|
|
2426
|
+
/**
|
|
2427
|
+
* @default false
|
|
2428
|
+
*/
|
|
2429
|
+
pickOnly?: boolean
|
|
2430
|
+
|
|
2431
|
+
boundingVolume?: BoundingSphere | AxisAlignedBoundingBox
|
|
2432
|
+
orientedBoundingBox?: OrientedBoundingBox
|
|
2433
|
+
/**
|
|
2434
|
+
* @default true
|
|
2435
|
+
*/
|
|
2436
|
+
cull?: boolean
|
|
2437
|
+
/**
|
|
2438
|
+
* @default true
|
|
2439
|
+
*/
|
|
2440
|
+
occlude?: boolean
|
|
2441
|
+
|
|
2442
|
+
executeInClosestFrustum?: boolean
|
|
2443
|
+
pass?: Pass
|
|
2444
|
+
count?: number
|
|
2445
|
+
debugShowBoundingVolume?: boolean
|
|
2446
|
+
})
|
|
2447
|
+
|
|
2448
|
+
/**
|
|
2449
|
+
* Executes the draw command.
|
|
2450
|
+
*
|
|
2451
|
+
* @param {Context} context The renderer context in which to draw.
|
|
2452
|
+
* @param {PassState} [passState] The state for the current render pass.
|
|
2453
|
+
*/
|
|
2454
|
+
execute: (context: Context, passState: PassState) => void
|
|
2455
|
+
/**
|
|
2456
|
+
* @private
|
|
2457
|
+
*/
|
|
2458
|
+
static shallowClone: (command: DrawCommand, result?: DrawCommand) => DrawCommand
|
|
2459
|
+
/**
|
|
2460
|
+
* The bounding volume of the geometry in world space. This is used for culling and frustum selection.
|
|
2461
|
+
* <p>
|
|
2462
|
+
* For best rendering performance, use the tightest possible bounding volume. Although
|
|
2463
|
+
* <code>undefined</code> is allowed, always try to provide a bounding volume to
|
|
2464
|
+
* allow the tightest possible near and far planes to be computed for the scene, and
|
|
2465
|
+
* minimize the number of frustums needed.
|
|
2466
|
+
* </p>
|
|
2467
|
+
*
|
|
2468
|
+
* @memberof DrawCommand.prototype
|
|
2469
|
+
* @type {Object}
|
|
2470
|
+
* @default undefined
|
|
2471
|
+
*
|
|
2472
|
+
* @see DrawCommand#debugShowBoundingVolume
|
|
2473
|
+
*/
|
|
2474
|
+
boundingVolume: Object
|
|
2475
|
+
|
|
2476
|
+
/**
|
|
2477
|
+
* The oriented bounding box of the geometry in world space. If this is defined, it is used instead of
|
|
2478
|
+
* {@link DrawCommand#boundingVolume} for plane intersection testing.
|
|
2479
|
+
*
|
|
2480
|
+
* @memberof DrawCommand.prototype
|
|
2481
|
+
* @type {OrientedBoundingBox}
|
|
2482
|
+
* @default undefined
|
|
2483
|
+
*
|
|
2484
|
+
* @see DrawCommand#debugShowBoundingVolume
|
|
2485
|
+
*/
|
|
2486
|
+
orientedBoundingBox: OrientedBoundingBox
|
|
2487
|
+
|
|
2488
|
+
/**
|
|
2489
|
+
* When <code>true</code>, the renderer frustum and horizon culls the command based on its {@link DrawCommand#boundingVolume}.
|
|
2490
|
+
* If the command was already culled, set this to <code>false</code> for a performance improvement.
|
|
2491
|
+
*
|
|
2492
|
+
* @memberof DrawCommand.prototype
|
|
2493
|
+
* @type {Boolean}
|
|
2494
|
+
* @default true
|
|
2495
|
+
*/
|
|
2496
|
+
cull: boolean
|
|
2497
|
+
|
|
2498
|
+
/**
|
|
2499
|
+
* When <code>true</code>, the horizon culls the command based on its {@link DrawCommand#boundingVolume}.
|
|
2500
|
+
* {@link DrawCommand#cull} must also be <code>true</code> in order for the command to be culled.
|
|
2501
|
+
*
|
|
2502
|
+
* @memberof DrawCommand.prototype
|
|
2503
|
+
* @type {Boolean}
|
|
2504
|
+
* @default true
|
|
2505
|
+
*/
|
|
2506
|
+
occlude: boolean
|
|
2507
|
+
|
|
2508
|
+
/**
|
|
2509
|
+
* The transformation from the geometry in model space to world space.
|
|
2510
|
+
* <p>
|
|
2511
|
+
* When <code>undefined</code>, the geometry is assumed to be defined in world space.
|
|
2512
|
+
* </p>
|
|
2513
|
+
*
|
|
2514
|
+
* @memberof DrawCommand.prototype
|
|
2515
|
+
* @type {Matrix4}
|
|
2516
|
+
* @default undefined
|
|
2517
|
+
*/
|
|
2518
|
+
modelMatrix: Matrix4
|
|
2519
|
+
|
|
2520
|
+
/**
|
|
2521
|
+
* The type of geometry in the vertex array.
|
|
2522
|
+
*
|
|
2523
|
+
* @memberof DrawCommand.prototype
|
|
2524
|
+
* @type {PrimitiveType}
|
|
2525
|
+
* @default PrimitiveType.TRIANGLES
|
|
2526
|
+
*/
|
|
2527
|
+
primitiveType: PrimitiveType
|
|
2528
|
+
|
|
2529
|
+
/**
|
|
2530
|
+
* The vertex array.
|
|
2531
|
+
*
|
|
2532
|
+
* @memberof DrawCommand.prototype
|
|
2533
|
+
* @type {VertexArray}
|
|
2534
|
+
* @default undefined
|
|
2535
|
+
*/
|
|
2536
|
+
vertexArray: VertexArray
|
|
2537
|
+
|
|
2538
|
+
/**
|
|
2539
|
+
* The number of vertices to draw in the vertex array.
|
|
2540
|
+
*
|
|
2541
|
+
* @memberof DrawCommand.prototype
|
|
2542
|
+
* @type {Number}
|
|
2543
|
+
* @default undefined
|
|
2544
|
+
*/
|
|
2545
|
+
count: number
|
|
2546
|
+
|
|
2547
|
+
/**
|
|
2548
|
+
* The offset to start drawing in the vertex array.
|
|
2549
|
+
*
|
|
2550
|
+
* @memberof DrawCommand.prototype
|
|
2551
|
+
* @type {Number}
|
|
2552
|
+
* @default 0
|
|
2553
|
+
*/
|
|
2554
|
+
offset: number
|
|
2555
|
+
|
|
2556
|
+
/**
|
|
2557
|
+
* The number of instances to draw.
|
|
2558
|
+
*
|
|
2559
|
+
* @memberof DrawCommand.prototype
|
|
2560
|
+
* @type {Number}
|
|
2561
|
+
* @default 0
|
|
2562
|
+
*/
|
|
2563
|
+
instanceCount: number
|
|
2564
|
+
|
|
2565
|
+
/**
|
|
2566
|
+
* The shader program to apply.
|
|
2567
|
+
*
|
|
2568
|
+
* @memberof DrawCommand.prototype
|
|
2569
|
+
* @type {ShaderProgram}
|
|
2570
|
+
* @default undefined
|
|
2571
|
+
*/
|
|
2572
|
+
shaderProgram: ShaderProgram
|
|
2573
|
+
|
|
2574
|
+
/**
|
|
2575
|
+
* Whether this command should cast shadows when shadowing is enabled.
|
|
2576
|
+
*
|
|
2577
|
+
* @memberof DrawCommand.prototype
|
|
2578
|
+
* @type {Boolean}
|
|
2579
|
+
* @default false
|
|
2580
|
+
*/
|
|
2581
|
+
castShadows: boolean
|
|
2582
|
+
|
|
2583
|
+
/**
|
|
2584
|
+
* Whether this command should receive shadows when shadowing is enabled.
|
|
2585
|
+
*
|
|
2586
|
+
* @memberof DrawCommand.prototype
|
|
2587
|
+
* @type {Boolean}
|
|
2588
|
+
* @default false
|
|
2589
|
+
*/
|
|
2590
|
+
receiveShadows: boolean
|
|
2591
|
+
|
|
2592
|
+
/**
|
|
2593
|
+
* An object with functions whose names match the uniforms in the shader program
|
|
2594
|
+
* and return values to set those uniforms.
|
|
2595
|
+
*
|
|
2596
|
+
* @memberof DrawCommand.prototype
|
|
2597
|
+
* @type {Object}
|
|
2598
|
+
* @default undefined
|
|
2599
|
+
*/
|
|
2600
|
+
uniformMap: { [key: string]: () => (number | boolean | number[] | Cartesian2 | Cartesian3 | Cartesian4 | Color | Matrix2 | Matrix3 | Matrix4 | Texture | CubeMap) }
|
|
2601
|
+
|
|
2602
|
+
/**
|
|
2603
|
+
* The render state.
|
|
2604
|
+
*
|
|
2605
|
+
* @memberof DrawCommand.prototype
|
|
2606
|
+
* @type {RenderState}
|
|
2607
|
+
* @default undefined
|
|
2608
|
+
*/
|
|
2609
|
+
renderState: RenderState
|
|
2610
|
+
|
|
2611
|
+
/**
|
|
2612
|
+
* The framebuffer to draw to.
|
|
2613
|
+
*
|
|
2614
|
+
* @memberof DrawCommand.prototype
|
|
2615
|
+
* @type {Framebuffer}
|
|
2616
|
+
* @default undefined
|
|
2617
|
+
*/
|
|
2618
|
+
framebuffer: Framebuffer
|
|
2619
|
+
|
|
2620
|
+
/**
|
|
2621
|
+
* The pass when to render.
|
|
2622
|
+
*
|
|
2623
|
+
* @memberof DrawCommand.prototype
|
|
2624
|
+
* @type {Pass}
|
|
2625
|
+
* @default undefined
|
|
2626
|
+
*/
|
|
2627
|
+
pass: Pass
|
|
2628
|
+
|
|
2629
|
+
/**
|
|
2630
|
+
* Specifies if this command is only to be executed in the frustum closest
|
|
2631
|
+
* to the eye containing the bounding volume. Defaults to <code>false</code>.
|
|
2632
|
+
*
|
|
2633
|
+
* @memberof DrawCommand.prototype
|
|
2634
|
+
* @type {Boolean}
|
|
2635
|
+
* @default false
|
|
2636
|
+
*/
|
|
2637
|
+
executeInClosestFrustum: boolean
|
|
2638
|
+
|
|
2639
|
+
/**
|
|
2640
|
+
* The object who created this command. This is useful for debugging command
|
|
2641
|
+
* execution; it allows us to see who created a command when we only have a
|
|
2642
|
+
* reference to the command, and can be used to selectively execute commands
|
|
2643
|
+
* with {@link Scene#debugCommandFilter}.
|
|
2644
|
+
*
|
|
2645
|
+
* @memberof DrawCommand.prototype
|
|
2646
|
+
* @type {Object}
|
|
2647
|
+
* @default undefined
|
|
2648
|
+
*
|
|
2649
|
+
* @see Scene#debugCommandFilter
|
|
2650
|
+
*/
|
|
2651
|
+
owner: Object
|
|
2652
|
+
|
|
2653
|
+
/**
|
|
2654
|
+
* This property is for debugging only; it is not for production use nor is it optimized.
|
|
2655
|
+
* <p>
|
|
2656
|
+
* Draws the {@link DrawCommand#boundingVolume} for this command, assuming it is a sphere, when the command executes.
|
|
2657
|
+
* </p>
|
|
2658
|
+
*
|
|
2659
|
+
* @memberof DrawCommand.prototype
|
|
2660
|
+
* @type {Boolean}
|
|
2661
|
+
* @default false
|
|
2662
|
+
*
|
|
2663
|
+
* @see DrawCommand#boundingVolume
|
|
2664
|
+
*/
|
|
2665
|
+
debugShowBoundingVolume: boolean
|
|
2666
|
+
|
|
2667
|
+
/**
|
|
2668
|
+
* Used to implement Scene.debugShowFrustums.
|
|
2669
|
+
* @private
|
|
2670
|
+
*/
|
|
2671
|
+
debugOverlappingFrustums: boolean
|
|
2672
|
+
/**
|
|
2673
|
+
* A GLSL string that will evaluate to a pick id. When <code>undefined</code>, the command will only draw depth
|
|
2674
|
+
* during the pick pass.
|
|
2675
|
+
*
|
|
2676
|
+
* @memberof DrawCommand.prototype
|
|
2677
|
+
* @type {String}
|
|
2678
|
+
* @default undefined
|
|
2679
|
+
*/
|
|
2680
|
+
pickId: string
|
|
2681
|
+
/**
|
|
2682
|
+
* Whether this command should be executed in the pick pass only.
|
|
2683
|
+
*
|
|
2684
|
+
* @memberof DrawCommand.prototype
|
|
2685
|
+
* @type {Boolean}
|
|
2686
|
+
* @default false
|
|
2687
|
+
*/
|
|
2688
|
+
pickOnly: boolean
|
|
2689
|
+
}
|
|
2690
|
+
/** renderer-private: end **/
|
|
2691
|
+
|
|
2692
|
+
export as namespace Cesium
|