@babylonjs/loaders 5.17.0 → 5.19.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,484 @@
1
+ import { __extends } from "tslib";
2
+ /* eslint-disable @typescript-eslint/naming-convention */
3
+ import { Animation } from "@babylonjs/core/Animations/animation.js";
4
+ import { Quaternion, Vector3, Matrix } from "@babylonjs/core/Maths/math.vector.js";
5
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
6
+ import { Material } from "@babylonjs/core/Materials/material.js";
7
+ var parseIntIndex = function (str) {
8
+ var targetIndex = parseInt(str);
9
+ if (isNaN(targetIndex)) {
10
+ return -1;
11
+ }
12
+ return targetIndex;
13
+ };
14
+ var getGltfNode = function (gltf, index) {
15
+ if (gltf.nodes) {
16
+ var i = parseIntIndex(index);
17
+ if (i != -1) {
18
+ return gltf.nodes[i];
19
+ }
20
+ }
21
+ return null;
22
+ };
23
+ var getGltfMaterial = function (gltf, index) {
24
+ if (gltf.materials) {
25
+ var i = parseIntIndex(index);
26
+ if (i != -1) {
27
+ return gltf.materials[i];
28
+ }
29
+ }
30
+ return null;
31
+ };
32
+ var getGltfCamera = function (gltf, index) {
33
+ if (gltf.cameras) {
34
+ var i = parseIntIndex(index);
35
+ if (i != -1) {
36
+ return gltf.cameras[i];
37
+ }
38
+ }
39
+ return null;
40
+ };
41
+ var getGltfExtension = function (gltf, index) {
42
+ if (gltf.extensions && index) {
43
+ return gltf.extensions[index];
44
+ }
45
+ return null;
46
+ };
47
+ var getMatrix = function (_target, source, offset, scale) {
48
+ return scale ? Matrix.FromArray(source, offset).scale(scale) : Matrix.FromArray(source, offset);
49
+ };
50
+ var getVector3 = function (_target, source, offset, scale) {
51
+ return scale ? Vector3.FromArray(source, offset).scaleInPlace(scale) : Vector3.FromArray(source, offset);
52
+ };
53
+ var getQuaternion = function (_target, source, offset, scale) {
54
+ return scale ? Quaternion.FromArray(source, offset).scaleInPlace(scale) : Quaternion.FromArray(source, offset);
55
+ };
56
+ var getColor3 = function (_target, source, offset, scale) {
57
+ return scale ? Color3.FromArray(source, offset).scale(scale) : Color3.FromArray(source, offset);
58
+ };
59
+ var getAlpha = function (_target, source, offset, scale) {
60
+ return scale ? source[offset + 3] * scale : source[offset + 3];
61
+ };
62
+ var getFloat = function (_target, source, offset, scale) {
63
+ return scale ? source[offset] * scale : source[offset];
64
+ };
65
+ var getMinusFloat = function (_target, source, offset, scale) {
66
+ return -(scale ? source[offset] * scale : source[offset]);
67
+ };
68
+ var getNextFloat = function (_target, source, offset, scale) {
69
+ return scale ? source[offset + 1] * scale : source[offset + 1];
70
+ };
71
+ var getFloatBy2 = function (_target, source, offset, scale) {
72
+ return (scale ? source[offset] * scale : source[offset]) * 2;
73
+ };
74
+ var getWeights = function (target, source, offset, scale) {
75
+ if (target._numMorphTargets) {
76
+ var value = new Array(target._numMorphTargets);
77
+ for (var i = 0; i < target._numMorphTargets; i++) {
78
+ value[i] = scale ? source[offset++] * scale : source[offset++];
79
+ }
80
+ return value;
81
+ }
82
+ return null;
83
+ };
84
+ var AbstractAnimationPointerPropertyInfos = /** @class */ (function () {
85
+ function AbstractAnimationPointerPropertyInfos(type, name, get) {
86
+ this.type = type;
87
+ this.name = name;
88
+ this.get = get;
89
+ }
90
+ AbstractAnimationPointerPropertyInfos.prototype._buildAnimation = function (animatable, fps, keys, babylonAnimationGroup, animationTargetOverride) {
91
+ if (animationTargetOverride === void 0) { animationTargetOverride = null; }
92
+ if (animatable || animationTargetOverride) {
93
+ var animationName = "".concat(babylonAnimationGroup.name, "_channel").concat(babylonAnimationGroup.targetedAnimations.length, "_").concat(this.name);
94
+ var babylonAnimation = new Animation(animationName, this.name, fps, this.type);
95
+ babylonAnimation.setKeys(keys);
96
+ if (animationTargetOverride != null && animationTargetOverride.animations != null) {
97
+ animationTargetOverride.animations.push(babylonAnimation);
98
+ babylonAnimationGroup.addTargetedAnimation(babylonAnimation, animationTargetOverride);
99
+ }
100
+ else if (animatable) {
101
+ animatable.animations = animatable.animations || Array(1);
102
+ animatable.animations.push(babylonAnimation);
103
+ babylonAnimationGroup.addTargetedAnimation(babylonAnimation, animatable);
104
+ }
105
+ }
106
+ };
107
+ AbstractAnimationPointerPropertyInfos.prototype.isValid = function (_target) {
108
+ return true;
109
+ };
110
+ return AbstractAnimationPointerPropertyInfos;
111
+ }());
112
+ var TransformNodeAnimationPointerPropertyInfos = /** @class */ (function (_super) {
113
+ __extends(TransformNodeAnimationPointerPropertyInfos, _super);
114
+ function TransformNodeAnimationPointerPropertyInfos(type, name, get) {
115
+ if (get === void 0) { get = getVector3; }
116
+ return _super.call(this, type, name, get) || this;
117
+ }
118
+ TransformNodeAnimationPointerPropertyInfos.prototype.isValid = function (target) {
119
+ return target._babylonTransformNode !== null && target._babylonTransformNode !== undefined;
120
+ };
121
+ TransformNodeAnimationPointerPropertyInfos.prototype.buildAnimations = function (target, fps, keys, group, animationTargetOverride) {
122
+ if (animationTargetOverride === void 0) { animationTargetOverride = null; }
123
+ return this._buildAnimation(target._babylonTransformNode, fps, keys, group, animationTargetOverride);
124
+ };
125
+ return TransformNodeAnimationPointerPropertyInfos;
126
+ }(AbstractAnimationPointerPropertyInfos));
127
+ var CameraAnimationPointerPropertyInfos = /** @class */ (function (_super) {
128
+ __extends(CameraAnimationPointerPropertyInfos, _super);
129
+ function CameraAnimationPointerPropertyInfos(type, name, get) {
130
+ if (get === void 0) { get = getFloat; }
131
+ return _super.call(this, type, name, get) || this;
132
+ }
133
+ CameraAnimationPointerPropertyInfos.prototype.isValid = function (target) {
134
+ return target._babylonCamera != null && target._babylonCamera !== undefined;
135
+ };
136
+ CameraAnimationPointerPropertyInfos.prototype.buildAnimations = function (target, fps, keys, group, animationTargetOverride) {
137
+ if (animationTargetOverride === void 0) { animationTargetOverride = null; }
138
+ return this._buildAnimation(target._babylonCamera, fps, keys, group, animationTargetOverride);
139
+ };
140
+ return CameraAnimationPointerPropertyInfos;
141
+ }(AbstractAnimationPointerPropertyInfos));
142
+ var MaterialAnimationPointerPropertyInfos = /** @class */ (function (_super) {
143
+ __extends(MaterialAnimationPointerPropertyInfos, _super);
144
+ function MaterialAnimationPointerPropertyInfos(type, name, get, fillMode) {
145
+ if (get === void 0) { get = getFloat; }
146
+ if (fillMode === void 0) { fillMode = Material.TriangleFillMode; }
147
+ var _this = _super.call(this, type, name, get) || this;
148
+ _this.fillMode = fillMode;
149
+ return _this;
150
+ }
151
+ MaterialAnimationPointerPropertyInfos.prototype.isValid = function (target) {
152
+ var data = target._data;
153
+ if (data) {
154
+ var c = data[this.fillMode];
155
+ if (c) {
156
+ return c.babylonMaterial !== null && c.babylonMaterial !== undefined;
157
+ }
158
+ }
159
+ return false;
160
+ };
161
+ MaterialAnimationPointerPropertyInfos.prototype.buildAnimations = function (target, fps, keys, group, animationTargetOverride) {
162
+ if (animationTargetOverride === void 0) { animationTargetOverride = null; }
163
+ return this._buildAnimation(target._data[this.fillMode].babylonMaterial, fps, keys, group, animationTargetOverride);
164
+ };
165
+ return MaterialAnimationPointerPropertyInfos;
166
+ }(AbstractAnimationPointerPropertyInfos));
167
+ var LightAnimationPointerPropertyInfos = /** @class */ (function (_super) {
168
+ __extends(LightAnimationPointerPropertyInfos, _super);
169
+ function LightAnimationPointerPropertyInfos(type, name, get) {
170
+ if (get === void 0) { get = getFloat; }
171
+ return _super.call(this, type, name, get) || this;
172
+ }
173
+ LightAnimationPointerPropertyInfos.prototype.isValid = function (target) {
174
+ return target && target.length != 0;
175
+ };
176
+ // note : the extensions array store directly the BabylonLight reference
177
+ LightAnimationPointerPropertyInfos.prototype.buildAnimations = function (target, fps, keys, group, animationTargetOverride, params) {
178
+ if (animationTargetOverride === void 0) { animationTargetOverride = null; }
179
+ var i = parseIntIndex(params[1]);
180
+ var l = i >= 0 && i < target.lights.length ? target.lights[i] : null;
181
+ return this._buildAnimation(l._babylonLight, fps, keys, group, animationTargetOverride);
182
+ };
183
+ return LightAnimationPointerPropertyInfos;
184
+ }(AbstractAnimationPointerPropertyInfos));
185
+ var WeightAnimationPointerPropertyInfos = /** @class */ (function (_super) {
186
+ __extends(WeightAnimationPointerPropertyInfos, _super);
187
+ function WeightAnimationPointerPropertyInfos(type, name, get) {
188
+ if (get === void 0) { get = getWeights; }
189
+ return _super.call(this, type, name, get) || this;
190
+ }
191
+ WeightAnimationPointerPropertyInfos.prototype.isValid = function (target) {
192
+ return target._numMorphTargets;
193
+ };
194
+ WeightAnimationPointerPropertyInfos.prototype.buildAnimations = function (targetNode, fps, keys, babylonAnimationGroup, _animationTargetOverride) {
195
+ if (_animationTargetOverride === void 0) { _animationTargetOverride = null; }
196
+ if (targetNode._numMorphTargets) {
197
+ var _loop_1 = function (targetIndex) {
198
+ var animationName = "".concat(babylonAnimationGroup.name, "_channel").concat(babylonAnimationGroup.targetedAnimations.length);
199
+ var babylonAnimation = new Animation(animationName, this_1.name, fps, this_1.type);
200
+ babylonAnimation.setKeys(keys.map(function (key) { return ({
201
+ frame: key.frame,
202
+ inTangent: key.inTangent ? key.inTangent[targetIndex] : undefined,
203
+ value: key.value[targetIndex],
204
+ outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined,
205
+ interpolation: key.interpolation,
206
+ }); }));
207
+ if (targetNode._primitiveBabylonMeshes) {
208
+ for (var _i = 0, _a = targetNode._primitiveBabylonMeshes; _i < _a.length; _i++) {
209
+ var m = _a[_i];
210
+ var babylonMesh = m;
211
+ if (babylonMesh.morphTargetManager) {
212
+ var morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);
213
+ var babylonAnimationClone = babylonAnimation.clone();
214
+ morphTarget.animations.push(babylonAnimationClone);
215
+ babylonAnimationGroup.addTargetedAnimation(babylonAnimationClone, morphTarget);
216
+ }
217
+ }
218
+ }
219
+ };
220
+ var this_1 = this;
221
+ for (var targetIndex = 0; targetIndex < targetNode._numMorphTargets; targetIndex++) {
222
+ _loop_1(targetIndex);
223
+ }
224
+ }
225
+ };
226
+ return WeightAnimationPointerPropertyInfos;
227
+ }(AbstractAnimationPointerPropertyInfos));
228
+ var CoreAnimationNodesPointerMap = {
229
+ getTarget: getGltfNode,
230
+ hasIndex: true,
231
+ matrix: {
232
+ properties: [new TransformNodeAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_MATRIX, "matrix", getMatrix)],
233
+ },
234
+ translation: {
235
+ properties: [new TransformNodeAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_VECTOR3, "position")],
236
+ },
237
+ rotation: {
238
+ properties: [new TransformNodeAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_QUATERNION, "rotationQuaternion", getQuaternion)],
239
+ },
240
+ scale: {
241
+ properties: [new TransformNodeAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_VECTOR3, "scaling")],
242
+ },
243
+ weights: {
244
+ getStride: function (target) {
245
+ return target._numMorphTargets;
246
+ },
247
+ properties: [new WeightAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "influence")],
248
+ },
249
+ };
250
+ var CoreAnimationCamerasPointerMap = {
251
+ hasIndex: true,
252
+ getTarget: getGltfCamera,
253
+ orthographic: {
254
+ xmag: {
255
+ properties: [
256
+ new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "orthoLeft", getMinusFloat),
257
+ new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "orthoRight", getNextFloat),
258
+ ],
259
+ },
260
+ ymag: {
261
+ properties: [
262
+ new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "orthoBottom", getMinusFloat),
263
+ new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "orthoTop", getNextFloat),
264
+ ],
265
+ },
266
+ zfar: {
267
+ properties: [new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "maxZ")],
268
+ },
269
+ znear: {
270
+ properties: [new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "minZ")],
271
+ },
272
+ },
273
+ perspective: {
274
+ aspectRatio: {
275
+ // not supported.
276
+ },
277
+ yfov: {
278
+ properties: [new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "fov")],
279
+ },
280
+ zfar: {
281
+ properties: [new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "maxZ")],
282
+ },
283
+ znear: {
284
+ properties: [new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "minZ")],
285
+ },
286
+ },
287
+ };
288
+ var CoreAnimationMaterialsPointerMap = {
289
+ hasIndex: true,
290
+ getTarget: getGltfMaterial,
291
+ pbrMetallicRoughness: {
292
+ baseColorFactor: {
293
+ properties: [
294
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_COLOR3, "albedoColor", getColor3),
295
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "alpha", getAlpha),
296
+ ],
297
+ },
298
+ metallicFactor: {
299
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "metallic")],
300
+ },
301
+ roughnessFactor: {
302
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "roughness")],
303
+ },
304
+ baseColorTexture: {
305
+ extensions: {
306
+ KHR_texture_transform: {
307
+ scale: {
308
+ properties: [
309
+ // MAY introduce set scale(Vector2) into texture.
310
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "albedoTexture.uScale"),
311
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "albedoTexture.vScale", getNextFloat),
312
+ ],
313
+ },
314
+ offset: {
315
+ properties: [
316
+ // MAY introduce set offset(Vector2) into texture.
317
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "albedoTexture.uOffset"),
318
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "albedoTexture.vOffset", getNextFloat),
319
+ ],
320
+ },
321
+ rotation: {
322
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "albedoTexture.wAng", getMinusFloat)],
323
+ },
324
+ },
325
+ },
326
+ },
327
+ },
328
+ emissiveFactor: {
329
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_COLOR3, "emissiveColor", getColor3)],
330
+ },
331
+ normalTexture: {
332
+ scale: {
333
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "bumpTexture.level")],
334
+ },
335
+ },
336
+ occlusionTexture: {
337
+ strength: {
338
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "ambientTextureStrength")],
339
+ },
340
+ extensions: {
341
+ KHR_texture_transform: {
342
+ scale: {
343
+ properties: [
344
+ // MAY introduce set scale(Vector2) into texture.
345
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "ambientTexture.uScale"),
346
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "ambientTexture.vScale", getNextFloat),
347
+ ],
348
+ },
349
+ offset: {
350
+ properties: [
351
+ // MAY introduce set offset(Vector2) into texture.
352
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "ambientTexture.uOffset"),
353
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "ambientTexture.vOffset", getNextFloat),
354
+ ],
355
+ },
356
+ rotation: {
357
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "ambientTexture.wAng", getMinusFloat)],
358
+ },
359
+ },
360
+ },
361
+ },
362
+ emissiveTexture: {
363
+ extensions: {
364
+ KHR_texture_transform: {
365
+ scale: {
366
+ properties: [
367
+ // MAY introduce set scale(Vector2) into texture.
368
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "emissiveTexture.uScale"),
369
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "emissiveTexture.vScale", getNextFloat),
370
+ ],
371
+ },
372
+ offset: {
373
+ properties: [
374
+ // MAY introduce set offset(Vector2) into texture.
375
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "emissiveTexture.uOffset"),
376
+ new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "emissiveTexture.vOffset", getNextFloat),
377
+ ],
378
+ },
379
+ rotation: {
380
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "emissiveTexture.wAng", getMinusFloat)],
381
+ },
382
+ },
383
+ },
384
+ },
385
+ extensions: {
386
+ KHR_materials_ior: {
387
+ ior: {
388
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "indexOfRefraction")],
389
+ },
390
+ },
391
+ KHR_materials_clearcoat: {
392
+ clearcoatFactor: {
393
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "clearCoat.intensity")],
394
+ },
395
+ clearcoatRoughnessFactor: {
396
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "clearCoat.roughness")],
397
+ },
398
+ },
399
+ KHR_materials_sheen: {
400
+ sheenColorFactor: {
401
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_COLOR3, "sheen.color", getColor3)],
402
+ },
403
+ sheenRoughnessFactor: {
404
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "sheen.roughness")],
405
+ },
406
+ },
407
+ KHR_materials_specular: {
408
+ specularFactor: {
409
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "metallicF0Factor")],
410
+ },
411
+ specularColorFactor: {
412
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_COLOR3, "metallicReflectanceColor", getColor3)],
413
+ },
414
+ },
415
+ KHR_materials_emissive_strength: {
416
+ emissiveStrength: {
417
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "emissiveIntensity")],
418
+ },
419
+ },
420
+ KHR_materials_transmission: {
421
+ transmissionFactor: {
422
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "subSurface.refractionIntensity")],
423
+ },
424
+ },
425
+ KHR_materials_volume: {
426
+ attenuationColor: {
427
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_COLOR3, "subSurface.tintColor", getColor3)],
428
+ },
429
+ attenuationDistance: {
430
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "subSurface.tintColorAtDistance")],
431
+ },
432
+ thicknessFactor: {
433
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "subSurface.maximumThickness")],
434
+ },
435
+ },
436
+ KHR_materials_iridescence: {
437
+ iridescenceFactor: {
438
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "iridescence.intensity")],
439
+ },
440
+ iridescenceIor: {
441
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "iridescence.indexOfRefraction")],
442
+ },
443
+ iridescenceThicknessMinimum: {
444
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "iridescence.minimumThickness")],
445
+ },
446
+ iridescenceThicknessMaximum: {
447
+ properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "iridescence.maximumThickness")],
448
+ },
449
+ },
450
+ },
451
+ };
452
+ var CoreAnimationExtensionsPointerMap = {
453
+ getTarget: getGltfExtension,
454
+ KHR_lights_punctual: {
455
+ isIndex: true,
456
+ lights: {
457
+ hasIndex: true,
458
+ color: {
459
+ properties: [new LightAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_COLOR3, "diffuse", getColor3)],
460
+ },
461
+ intensity: {
462
+ properties: [new LightAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "intensity")],
463
+ },
464
+ range: {
465
+ properties: [new LightAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "range")],
466
+ },
467
+ spot: {
468
+ innerConeAngle: {
469
+ properties: [new LightAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "innerAngle", getFloatBy2)],
470
+ },
471
+ outerConeAngle: {
472
+ properties: [new LightAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, "angle", getFloatBy2)],
473
+ },
474
+ },
475
+ },
476
+ },
477
+ };
478
+ export var CoreAnimationPointerMap = {
479
+ nodes: CoreAnimationNodesPointerMap,
480
+ materials: CoreAnimationMaterialsPointerMap,
481
+ cameras: CoreAnimationCamerasPointerMap,
482
+ extensions: CoreAnimationExtensionsPointerMap,
483
+ };
484
+ //# sourceMappingURL=KHR_animation_pointer.map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KHR_animation_pointer.map.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_animation_pointer.map.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,OAAO,EAAE,SAAS,EAAE,gDAAkC;AAEtD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,6CAA+B;AACrE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,QAAQ,EAAE,8CAAgC;AAgBnD,IAAM,aAAa,GAAG,UAAC,GAAW;IAC9B,IAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,KAAK,CAAC,WAAW,CAAC,EAAE;QACpB,OAAO,CAAC,CAAC,CAAC;KACb;IACD,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAEF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AAkC,CAAC,SAAS,CAAC,mBAAmB,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;iBACjH;gBACD,cAAc,EAAE;oBACZ,UAAU,EAAE,CAAC,IAAI,kCAAkC,CAAC,SAAS,CAAC,mBAAmB,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;iBAC5G;aACJ;SACJ;KACJ;CACJ,CAAC;AAEF,MAAM,CAAC,IAAM,uBAAuB,GAAQ;IACxC,KAAK,EAAE,4BAA4B;IACnC,SAAS,EAAE,gCAAgC;IAC3C,OAAO,EAAE,8BAA8B;IACvC,UAAU,EAAE,iCAAiC;CAChD,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Animation } from \"core/Animations/animation\";\r\nimport type { AnimationGroup } from \"core/Animations/animationGroup\";\r\nimport { Quaternion, Vector3, Matrix } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { IGLTF } from \"../glTFLoaderInterfaces\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nexport type GetGltfNodeTargetFn = (source: IGLTF, indices: string) => any;\r\ntype GetValueFn = (target: any, source: Float32Array, offset: number, scale?: number) => any;\r\n\r\nexport interface IAnimationPointerPropertyInfos {\r\n type: number;\r\n name: string;\r\n get: GetValueFn;\r\n isValid(target: any): boolean;\r\n buildAnimations(target: any, fps: number, keys: any[], group: AnimationGroup, animationTargetOverride: Nullable<IAnimatable>, params?: any): void;\r\n}\r\n\r\nconst parseIntIndex = (str: string) => {\r\n const targetIndex = parseInt(str);\r\n if (isNaN(targetIndex)) {\r\n return -1;\r\n }\r\n return targetIndex;\r\n};\r\n\r\nconst getGltfNode: GetGltfNodeTargetFn = (gltf: IGLTF, index: string) => {\r\n if (gltf.nodes) {\r\n const i = parseIntIndex(index);\r\n if (i != -1) {\r\n return gltf.nodes[i];\r\n }\r\n }\r\n return null;\r\n};\r\n\r\nconst getGltfMaterial: GetGltfNodeTargetFn = (gltf: IGLTF, index: string) => {\r\n if (gltf.materials) {\r\n const i = parseIntIndex(index);\r\n if (i != -1) {\r\n return gltf.materials[i];\r\n }\r\n }\r\n return null;\r\n};\r\n\r\nconst getGltfCamera: GetGltfNodeTargetFn = (gltf: IGLTF, index: string) => {\r\n if (gltf.cameras) {\r\n const i = parseIntIndex(index);\r\n if (i != -1) {\r\n return gltf.cameras[i];\r\n }\r\n }\r\n return null;\r\n};\r\n\r\nconst getGltfExtension: GetGltfNodeTargetFn = (gltf: IGLTF, index: string) => {\r\n if (gltf.extensions && index) {\r\n return gltf.extensions[index];\r\n }\r\n return null;\r\n};\r\n\r\nconst getMatrix: GetValueFn = (_target: any, source: Float32Array, offset: number, scale?: number) => {\r\n return scale ? Matrix.FromArray(source, offset).scale(scale) : Matrix.FromArray(source, offset);\r\n};\r\n\r\nconst getVector3: GetValueFn = (_target: any, source: Float32Array, offset: number, scale?: number) => {\r\n return scale ? Vector3.FromArray(source, offset).scaleInPlace(scale) : Vector3.FromArray(source, offset);\r\n};\r\n\r\nconst getQuaternion: GetValueFn = (_target: any, source: Float32Array, offset: number, scale?: number) => {\r\n return scale ? Quaternion.FromArray(source, offset).scaleInPlace(scale) : Quaternion.FromArray(source, offset);\r\n};\r\n\r\nconst getColor3: GetValueFn = (_target: any, source: Float32Array, offset: number, scale?: number) => {\r\n return scale ? Color3.FromArray(source, offset).scale(scale) : Color3.FromArray(source, offset);\r\n};\r\n\r\nconst getAlpha: GetValueFn = (_target: any, source: Float32Array, offset: number, scale?: number) => {\r\n return scale ? source[offset + 3] * scale : source[offset + 3];\r\n};\r\n\r\nconst getFloat: GetValueFn = (_target: any, source: Float32Array, offset: number, scale?: number) => {\r\n return scale ? source[offset] * scale : source[offset];\r\n};\r\n\r\nconst getMinusFloat: GetValueFn = (_target: any, source: Float32Array, offset: number, scale?: number) => {\r\n return -(scale ? source[offset] * scale : source[offset]);\r\n};\r\n\r\nconst getNextFloat: GetValueFn = (_target: any, source: Float32Array, offset: number, scale?: number) => {\r\n return scale ? source[offset + 1] * scale : source[offset + 1];\r\n};\r\n\r\nconst getFloatBy2: GetValueFn = (_target: any, source: Float32Array, offset: number, scale?: number) => {\r\n return (scale ? source[offset] * scale : source[offset]) * 2;\r\n};\r\n\r\nconst getWeights: GetValueFn = (target: any, source: Float32Array, offset: number, scale?: number) => {\r\n if (target._numMorphTargets) {\r\n const value = new Array<number>(target._numMorphTargets!);\r\n for (let i = 0; i < target._numMorphTargets!; i++) {\r\n value[i] = scale ? source[offset++] * scale : source[offset++];\r\n }\r\n return value;\r\n }\r\n return null;\r\n};\r\n\r\nabstract class AbstractAnimationPointerPropertyInfos implements IAnimationPointerPropertyInfos {\r\n public constructor(public type: number, public name: string, public get: GetValueFn) {}\r\n\r\n protected _buildAnimation(\r\n animatable: Nullable<IAnimatable>,\r\n fps: number,\r\n keys: any[],\r\n babylonAnimationGroup: AnimationGroup,\r\n animationTargetOverride: Nullable<IAnimatable> = null\r\n ) {\r\n if (animatable || animationTargetOverride) {\r\n const animationName = `${babylonAnimationGroup!.name}_channel${babylonAnimationGroup.targetedAnimations.length}_${this.name}`;\r\n const babylonAnimation = new Animation(animationName, this.name, fps, this.type);\r\n babylonAnimation.setKeys(keys);\r\n\r\n if (animationTargetOverride != null && animationTargetOverride.animations != null) {\r\n animationTargetOverride.animations.push(babylonAnimation);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, animationTargetOverride);\r\n } else if (animatable) {\r\n animatable.animations = animatable.animations || Array<Animation>(1);\r\n animatable.animations.push(babylonAnimation);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, animatable);\r\n }\r\n }\r\n }\r\n public isValid(_target: any): boolean {\r\n return true;\r\n }\r\n\r\n public abstract buildAnimations(target: any, fps: number, keys: any[], group: AnimationGroup, animationTargetOverride: Nullable<IAnimatable>, params?: any): void;\r\n}\r\n\r\nclass TransformNodeAnimationPointerPropertyInfos extends AbstractAnimationPointerPropertyInfos {\r\n public constructor(type: number, name: string, get: GetValueFn = getVector3) {\r\n super(type, name, get);\r\n }\r\n public isValid(target: any): boolean {\r\n return target._babylonTransformNode !== null && target._babylonTransformNode !== undefined;\r\n }\r\n\r\n public buildAnimations(target: any, fps: number, keys: any[], group: AnimationGroup, animationTargetOverride: Nullable<IAnimatable> = null): void {\r\n return this._buildAnimation(target._babylonTransformNode, fps, keys, group, animationTargetOverride);\r\n }\r\n}\r\n\r\nclass CameraAnimationPointerPropertyInfos extends AbstractAnimationPointerPropertyInfos {\r\n public constructor(type: number, name: string, get: GetValueFn = getFloat) {\r\n super(type, name, get);\r\n }\r\n\r\n public isValid(target: any): boolean {\r\n return target._babylonCamera != null && target._babylonCamera !== undefined;\r\n }\r\n\r\n public buildAnimations(target: any, fps: number, keys: any[], group: AnimationGroup, animationTargetOverride: Nullable<IAnimatable> = null): void {\r\n return this._buildAnimation(target._babylonCamera, fps, keys, group, animationTargetOverride);\r\n }\r\n}\r\n\r\nclass MaterialAnimationPointerPropertyInfos extends AbstractAnimationPointerPropertyInfos {\r\n public constructor(type: number, name: string, get: GetValueFn = getFloat, public fillMode: any = Material.TriangleFillMode) {\r\n super(type, name, get);\r\n }\r\n\r\n public isValid(target: any): boolean {\r\n const data = target._data;\r\n if (data) {\r\n const c = data[this.fillMode];\r\n if (c) {\r\n return c.babylonMaterial !== null && c.babylonMaterial !== undefined;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n public buildAnimations(target: any, fps: number, keys: any[], group: AnimationGroup, animationTargetOverride: Nullable<IAnimatable> = null): void {\r\n return this._buildAnimation(target._data[this.fillMode].babylonMaterial, fps, keys, group, animationTargetOverride);\r\n }\r\n}\r\n\r\nclass LightAnimationPointerPropertyInfos extends AbstractAnimationPointerPropertyInfos {\r\n public constructor(type: number, name: string, get: GetValueFn = getFloat) {\r\n super(type, name, get);\r\n }\r\n\r\n public isValid(target: any): boolean {\r\n return target && target.length != 0;\r\n }\r\n\r\n // note : the extensions array store directly the BabylonLight reference\r\n public buildAnimations(target: any, fps: number, keys: any[], group: AnimationGroup, animationTargetOverride: Nullable<IAnimatable> = null, params: any): void {\r\n const i = parseIntIndex(params[1]);\r\n const l = i >= 0 && i < target.lights.length ? target.lights[i] : null;\r\n return this._buildAnimation(l._babylonLight, fps, keys, group, animationTargetOverride);\r\n }\r\n}\r\n\r\nclass WeightAnimationPointerPropertyInfos extends AbstractAnimationPointerPropertyInfos {\r\n public constructor(type: number, name: string, get: GetValueFn = getWeights) {\r\n super(type, name, get);\r\n }\r\n public isValid(target: any): boolean {\r\n return target._numMorphTargets;\r\n }\r\n public buildAnimations(targetNode: any, fps: number, keys: any[], babylonAnimationGroup: AnimationGroup, _animationTargetOverride: Nullable<IAnimatable> = null): void {\r\n if (targetNode._numMorphTargets) {\r\n for (let targetIndex = 0; targetIndex < targetNode._numMorphTargets; targetIndex++) {\r\n const animationName = `${babylonAnimationGroup.name}_channel${babylonAnimationGroup.targetedAnimations.length}`;\r\n const babylonAnimation = new Animation(animationName, this.name, fps, this.type);\r\n babylonAnimation.setKeys(\r\n keys.map((key) => ({\r\n frame: key.frame,\r\n inTangent: key.inTangent ? key.inTangent[targetIndex] : undefined,\r\n value: key.value[targetIndex],\r\n outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined,\r\n interpolation: key.interpolation,\r\n }))\r\n );\r\n\r\n if (targetNode._primitiveBabylonMeshes) {\r\n for (const m of targetNode._primitiveBabylonMeshes) {\r\n const babylonMesh = m as Mesh;\r\n if (babylonMesh.morphTargetManager) {\r\n const morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);\r\n const babylonAnimationClone = babylonAnimation.clone();\r\n morphTarget.animations.push(babylonAnimationClone);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimationClone, morphTarget);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nconst CoreAnimationNodesPointerMap: any = {\r\n getTarget: getGltfNode,\r\n hasIndex: true,\r\n matrix: {\r\n properties: [new TransformNodeAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_MATRIX, \"matrix\", getMatrix)],\r\n },\r\n translation: {\r\n properties: [new TransformNodeAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_VECTOR3, \"position\")],\r\n },\r\n rotation: {\r\n properties: [new TransformNodeAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_QUATERNION, \"rotationQuaternion\", getQuaternion)],\r\n },\r\n scale: {\r\n properties: [new TransformNodeAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_VECTOR3, \"scaling\")],\r\n },\r\n weights: {\r\n getStride: (target: any) => {\r\n return target._numMorphTargets;\r\n },\r\n properties: [new WeightAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"influence\")],\r\n },\r\n};\r\n\r\nconst CoreAnimationCamerasPointerMap: any = {\r\n hasIndex: true,\r\n getTarget: getGltfCamera,\r\n orthographic: {\r\n xmag: {\r\n properties: [\r\n new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"orthoLeft\", getMinusFloat),\r\n new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"orthoRight\", getNextFloat),\r\n ],\r\n },\r\n ymag: {\r\n properties: [\r\n new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"orthoBottom\", getMinusFloat),\r\n new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"orthoTop\", getNextFloat),\r\n ],\r\n },\r\n zfar: {\r\n properties: [new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"maxZ\")],\r\n },\r\n znear: {\r\n properties: [new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"minZ\")],\r\n },\r\n },\r\n perspective: {\r\n aspectRatio: {\r\n // not supported.\r\n },\r\n yfov: {\r\n properties: [new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"fov\")],\r\n },\r\n zfar: {\r\n properties: [new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"maxZ\")],\r\n },\r\n znear: {\r\n properties: [new CameraAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"minZ\")],\r\n },\r\n },\r\n};\r\n\r\nconst CoreAnimationMaterialsPointerMap: any = {\r\n hasIndex: true,\r\n getTarget: getGltfMaterial,\r\n pbrMetallicRoughness: {\r\n baseColorFactor: {\r\n properties: [\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_COLOR3, \"albedoColor\", getColor3),\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"alpha\", getAlpha),\r\n ],\r\n },\r\n metallicFactor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"metallic\")],\r\n },\r\n roughnessFactor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"roughness\")],\r\n },\r\n baseColorTexture: {\r\n extensions: {\r\n KHR_texture_transform: {\r\n scale: {\r\n properties: [\r\n // MAY introduce set scale(Vector2) into texture.\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"albedoTexture.uScale\"),\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"albedoTexture.vScale\", getNextFloat),\r\n ],\r\n },\r\n offset: {\r\n properties: [\r\n // MAY introduce set offset(Vector2) into texture.\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"albedoTexture.uOffset\"),\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"albedoTexture.vOffset\", getNextFloat),\r\n ],\r\n },\r\n rotation: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"albedoTexture.wAng\", getMinusFloat)],\r\n },\r\n },\r\n },\r\n },\r\n },\r\n emissiveFactor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_COLOR3, \"emissiveColor\", getColor3)],\r\n },\r\n normalTexture: {\r\n scale: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"bumpTexture.level\")],\r\n },\r\n },\r\n occlusionTexture: {\r\n strength: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"ambientTextureStrength\")],\r\n },\r\n extensions: {\r\n KHR_texture_transform: {\r\n scale: {\r\n properties: [\r\n // MAY introduce set scale(Vector2) into texture.\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"ambientTexture.uScale\"),\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"ambientTexture.vScale\", getNextFloat),\r\n ],\r\n },\r\n offset: {\r\n properties: [\r\n // MAY introduce set offset(Vector2) into texture.\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"ambientTexture.uOffset\"),\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"ambientTexture.vOffset\", getNextFloat),\r\n ],\r\n },\r\n rotation: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"ambientTexture.wAng\", getMinusFloat)],\r\n },\r\n },\r\n },\r\n },\r\n emissiveTexture: {\r\n extensions: {\r\n KHR_texture_transform: {\r\n scale: {\r\n properties: [\r\n // MAY introduce set scale(Vector2) into texture.\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"emissiveTexture.uScale\"),\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"emissiveTexture.vScale\", getNextFloat),\r\n ],\r\n },\r\n offset: {\r\n properties: [\r\n // MAY introduce set offset(Vector2) into texture.\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"emissiveTexture.uOffset\"),\r\n new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"emissiveTexture.vOffset\", getNextFloat),\r\n ],\r\n },\r\n rotation: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"emissiveTexture.wAng\", getMinusFloat)],\r\n },\r\n },\r\n },\r\n },\r\n extensions: {\r\n KHR_materials_ior: {\r\n ior: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"indexOfRefraction\")],\r\n },\r\n },\r\n KHR_materials_clearcoat: {\r\n clearcoatFactor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"clearCoat.intensity\")],\r\n },\r\n clearcoatRoughnessFactor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"clearCoat.roughness\")],\r\n },\r\n },\r\n KHR_materials_sheen: {\r\n sheenColorFactor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_COLOR3, \"sheen.color\", getColor3)],\r\n },\r\n sheenRoughnessFactor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"sheen.roughness\")],\r\n },\r\n },\r\n KHR_materials_specular: {\r\n specularFactor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"metallicF0Factor\")],\r\n },\r\n specularColorFactor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_COLOR3, \"metallicReflectanceColor\", getColor3)],\r\n },\r\n },\r\n KHR_materials_emissive_strength: {\r\n emissiveStrength: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"emissiveIntensity\")],\r\n },\r\n },\r\n KHR_materials_transmission: {\r\n transmissionFactor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.refractionIntensity\")],\r\n },\r\n },\r\n KHR_materials_volume: {\r\n attenuationColor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_COLOR3, \"subSurface.tintColor\", getColor3)],\r\n },\r\n attenuationDistance: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.tintColorAtDistance\")],\r\n },\r\n thicknessFactor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.maximumThickness\")],\r\n },\r\n },\r\n KHR_materials_iridescence: {\r\n iridescenceFactor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.intensity\")],\r\n },\r\n iridescenceIor: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.indexOfRefraction\")],\r\n },\r\n iridescenceThicknessMinimum: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.minimumThickness\")],\r\n },\r\n iridescenceThicknessMaximum: {\r\n properties: [new MaterialAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.maximumThickness\")],\r\n },\r\n },\r\n },\r\n};\r\n\r\nconst CoreAnimationExtensionsPointerMap: any = {\r\n getTarget: getGltfExtension,\r\n KHR_lights_punctual: {\r\n isIndex: true,\r\n lights: {\r\n hasIndex: true, // we have an array of light into the extension.\r\n color: {\r\n properties: [new LightAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_COLOR3, \"diffuse\", getColor3)],\r\n },\r\n intensity: {\r\n properties: [new LightAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"intensity\")],\r\n },\r\n range: {\r\n properties: [new LightAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"range\")],\r\n },\r\n spot: {\r\n innerConeAngle: {\r\n properties: [new LightAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"innerAngle\", getFloatBy2)],\r\n },\r\n outerConeAngle: {\r\n properties: [new LightAnimationPointerPropertyInfos(Animation.ANIMATIONTYPE_FLOAT, \"angle\", getFloatBy2)],\r\n },\r\n },\r\n },\r\n },\r\n};\r\n\r\nexport const CoreAnimationPointerMap: any = {\r\n nodes: CoreAnimationNodesPointerMap,\r\n materials: CoreAnimationMaterialsPointerMap,\r\n cameras: CoreAnimationCamerasPointerMap,\r\n extensions: CoreAnimationExtensionsPointerMap,\r\n};\r\n"]}
@@ -15,6 +15,7 @@ export declare class KHR_lights implements IGLTFLoaderExtension {
15
15
  * Defines whether this extension is enabled.
16
16
  */
17
17
  enabled: boolean;
18
+ /** hidden */
18
19
  private _loader;
19
20
  private _lights?;
20
21
  /**
@@ -78,6 +78,7 @@ var KHR_lights = /** @class */ (function () {
78
78
  babylonLight.range = light.range == undefined ? Number.MAX_VALUE : light.range;
79
79
  babylonLight.parent = babylonMesh;
80
80
  _this._loader._babylonLights.push(babylonLight);
81
+ light._babylonLight = babylonLight;
81
82
  GLTFLoader.AddPointerMetadata(babylonLight, extensionContext);
82
83
  assign(babylonMesh);
83
84
  });
@@ -1 +1 @@
1
- {"version":3,"file":"KHR_lights_punctual.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_lights_punctual.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,gBAAgB,EAAE,mDAAqC;AAChE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AACpD,OAAO,EAAE,SAAS,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import type { Nullable } from \"core/types\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { DirectionalLight } from \"core/Lights/directionalLight\";\r\nimport { PointLight } from \"core/Lights/pointLight\";\r\nimport { SpotLight } from \"core/Lights/spotLight\";\r\nimport { Light } from \"core/Lights/light\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\n\r\nimport type { IKHRLightsPunctual_LightReference, IKHRLightsPunctual_Light, IKHRLightsPunctual } from \"babylonjs-gltf2interface\";\r\nimport { KHRLightsPunctual_LightType } from \"babylonjs-gltf2interface\";\r\nimport type { INode } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\n\r\nconst NAME = \"KHR_lights_punctual\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)\r\n */\r\nexport class KHR_lights implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n private _lights?: IKHRLightsPunctual_Light[];\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n delete this._lights;\r\n }\r\n\r\n /** @hidden */\r\n public onLoading(): void {\r\n const extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n const extension = extensions[this.name] as IKHRLightsPunctual;\r\n this._lights = extension.lights;\r\n }\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param node\r\n * @param assign\r\n * @hidden\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRLightsPunctual_LightReference, TransformNode>(context, node, this.name, (extensionContext, extension) => {\r\n return this._loader.loadNodeAsync(context, node, (babylonMesh) => {\r\n let babylonLight: Light;\r\n\r\n const light = ArrayItem.Get(extensionContext, this._lights, extension.light);\r\n const name = light.name || babylonMesh.name;\r\n\r\n this._loader.babylonScene._blockEntityCollection = !!this._loader._assetContainer;\r\n\r\n switch (light.type) {\r\n case KHRLightsPunctual_LightType.DIRECTIONAL: {\r\n babylonLight = new DirectionalLight(name, Vector3.Backward(), this._loader.babylonScene);\r\n break;\r\n }\r\n case KHRLightsPunctual_LightType.POINT: {\r\n babylonLight = new PointLight(name, Vector3.Zero(), this._loader.babylonScene);\r\n break;\r\n }\r\n case KHRLightsPunctual_LightType.SPOT: {\r\n const babylonSpotLight = new SpotLight(name, Vector3.Zero(), Vector3.Backward(), 0, 1, this._loader.babylonScene);\r\n babylonSpotLight.angle = ((light.spot && light.spot.outerConeAngle) || Math.PI / 4) * 2;\r\n babylonSpotLight.innerAngle = ((light.spot && light.spot.innerConeAngle) || 0) * 2;\r\n babylonLight = babylonSpotLight;\r\n break;\r\n }\r\n default: {\r\n this._loader.babylonScene._blockEntityCollection = false;\r\n throw new Error(`${extensionContext}: Invalid light type (${light.type})`);\r\n }\r\n }\r\n\r\n babylonLight._parentContainer = this._loader._assetContainer;\r\n this._loader.babylonScene._blockEntityCollection = false;\r\n babylonLight.falloffType = Light.FALLOFF_GLTF;\r\n babylonLight.diffuse = light.color ? Color3.FromArray(light.color) : Color3.White();\r\n babylonLight.intensity = light.intensity == undefined ? 1 : light.intensity;\r\n babylonLight.range = light.range == undefined ? Number.MAX_VALUE : light.range;\r\n babylonLight.parent = babylonMesh;\r\n\r\n this._loader._babylonLights.push(babylonLight);\r\n\r\n GLTFLoader.AddPointerMetadata(babylonLight, extensionContext);\r\n\r\n assign(babylonMesh);\r\n });\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_lights(loader));\r\n"]}
1
+ {"version":3,"file":"KHR_lights_punctual.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_lights_punctual.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,gBAAgB,EAAE,mDAAqC;AAChE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AACpD,OAAO,EAAE,SAAS,EAAE,4CAA8B;AAClD,OAAO,EAAE,KAAK,EAAE,wCAA0B;AAO1C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEtD,IAAM,IAAI,GAAG,qBAAqB,CAAC;AAEnC;;GAEG;AACH;IAeI;;;OAGG;IACH,oBAAY,MAAkB;QAlB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAgBxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,cAAc;IACP,4BAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,cAAc;IACP,8BAAS,GAAhB;QACI,IAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;QAChD,IAAI,UAAU,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACrC,IAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAQ,CAAC;YAC/C,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC;SACnC;IACL,CAAC;IAED;;;;;OAKG;IACI,kCAAa,GAAp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AY,CAAC,CAAC;gBAC/C,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC;gBAEnC,UAAU,CAAC,kBAAkB,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;gBAE9D,MAAM,CAAC,WAAW,CAAC,CAAC;YACxB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IACL,iBAAC;AAAD,CAAC,AA9FD,IA8FC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,UAAU,CAAC,MAAM,CAAC,EAAtB,CAAsB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { DirectionalLight } from \"core/Lights/directionalLight\";\r\nimport { PointLight } from \"core/Lights/pointLight\";\r\nimport { SpotLight } from \"core/Lights/spotLight\";\r\nimport { Light } from \"core/Lights/light\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\n\r\nimport type { IKHRLightsPunctual_LightReference } from \"babylonjs-gltf2interface\";\r\nimport { KHRLightsPunctual_LightType } from \"babylonjs-gltf2interface\";\r\nimport type { INode, IKHRLight } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\n\r\nconst NAME = \"KHR_lights_punctual\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)\r\n */\r\nexport class KHR_lights implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n /** hidden */\r\n private _loader: GLTFLoader;\r\n private _lights?: IKHRLight[];\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n delete this._lights;\r\n }\r\n\r\n /** @hidden */\r\n public onLoading(): void {\r\n const extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n const extension = extensions[this.name] as any;\r\n this._lights = extension.lights;\r\n }\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param node\r\n * @param assign\r\n * @hidden\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRLightsPunctual_LightReference, TransformNode>(context, node, this.name, (extensionContext, extension) => {\r\n return this._loader.loadNodeAsync(context, node, (babylonMesh) => {\r\n let babylonLight: Light;\r\n\r\n const light = ArrayItem.Get(extensionContext, this._lights, extension.light);\r\n const name = light.name || babylonMesh.name;\r\n\r\n this._loader.babylonScene._blockEntityCollection = !!this._loader._assetContainer;\r\n\r\n switch (light.type) {\r\n case KHRLightsPunctual_LightType.DIRECTIONAL: {\r\n babylonLight = new DirectionalLight(name, Vector3.Backward(), this._loader.babylonScene);\r\n break;\r\n }\r\n case KHRLightsPunctual_LightType.POINT: {\r\n babylonLight = new PointLight(name, Vector3.Zero(), this._loader.babylonScene);\r\n break;\r\n }\r\n case KHRLightsPunctual_LightType.SPOT: {\r\n const babylonSpotLight = new SpotLight(name, Vector3.Zero(), Vector3.Backward(), 0, 1, this._loader.babylonScene);\r\n babylonSpotLight.angle = ((light.spot && light.spot.outerConeAngle) || Math.PI / 4) * 2;\r\n babylonSpotLight.innerAngle = ((light.spot && light.spot.innerConeAngle) || 0) * 2;\r\n babylonLight = babylonSpotLight;\r\n break;\r\n }\r\n default: {\r\n this._loader.babylonScene._blockEntityCollection = false;\r\n throw new Error(`${extensionContext}: Invalid light type (${light.type})`);\r\n }\r\n }\r\n\r\n babylonLight._parentContainer = this._loader._assetContainer;\r\n this._loader.babylonScene._blockEntityCollection = false;\r\n babylonLight.falloffType = Light.FALLOFF_GLTF;\r\n babylonLight.diffuse = light.color ? Color3.FromArray(light.color) : Color3.White();\r\n babylonLight.intensity = light.intensity == undefined ? 1 : light.intensity;\r\n babylonLight.range = light.range == undefined ? Number.MAX_VALUE : light.range;\r\n babylonLight.parent = babylonMesh;\r\n\r\n this._loader._babylonLights.push(babylonLight);\r\n light._babylonLight = babylonLight;\r\n\r\n GLTFLoader.AddPointerMetadata(babylonLight, extensionContext);\r\n\r\n assign(babylonMesh);\r\n });\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_lights(loader));\r\n"]}
@@ -20,6 +20,7 @@ export * from "./KHR_mesh_quantization";
20
20
  export * from "./KHR_texture_basisu";
21
21
  export * from "./KHR_texture_transform";
22
22
  export * from "./KHR_xmp_json_ld";
23
+ export * from "./KHR_animation_pointer";
23
24
  export * from "./MSFT_audio_emitter";
24
25
  export * from "./MSFT_lod";
25
26
  export * from "./MSFT_minecraftMesh";