@galacean/effects-core 2.6.7 → 2.6.8

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/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.6.7
6
+ * Version: v2.6.8
7
7
  */
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -4141,6 +4141,1027 @@ var Blender = /*#__PURE__*/ function() {
4141
4141
  Blender.normalBlendFunction = new NormalBlend();
4142
4142
  Blender.additiveBlendFunction = new AdditiveBlend();
4143
4143
 
4144
+ /**
4145
+ * 四维向量
4146
+ */ var Vector4 = /*#__PURE__*/ function() {
4147
+ function Vector4(x, y, z, w) {
4148
+ if (x === void 0) x = 0;
4149
+ if (y === void 0) y = 0;
4150
+ if (z === void 0) z = 0;
4151
+ if (w === void 0) w = 0;
4152
+ this.x = x;
4153
+ this.y = y;
4154
+ this.z = z;
4155
+ this.w = w;
4156
+ }
4157
+ var _proto = Vector4.prototype;
4158
+ /**
4159
+ * 设置向量
4160
+ * @param x - x 轴分量
4161
+ * @param y - y 轴分量
4162
+ * @param z - z 轴分量
4163
+ * @param w - w 轴分量
4164
+ * @returns
4165
+ */ _proto.set = function set(x, y, z, w) {
4166
+ this.x = x;
4167
+ this.y = y;
4168
+ this.z = z;
4169
+ this.w = w;
4170
+ return this;
4171
+ };
4172
+ /**
4173
+ * 设置零向量
4174
+ * @returns 向量
4175
+ */ _proto.setZero = function setZero() {
4176
+ this.x = 0;
4177
+ this.y = 0;
4178
+ this.z = 0;
4179
+ this.w = 0;
4180
+ return this;
4181
+ };
4182
+ /**
4183
+ * 通过标量数值设置向量
4184
+ * @param num - 数值
4185
+ * @returns 向量
4186
+ */ _proto.setFromNumber = function setFromNumber(num) {
4187
+ this.x = num;
4188
+ this.y = num;
4189
+ this.z = num;
4190
+ this.w = num;
4191
+ return this;
4192
+ };
4193
+ /**
4194
+ * 通过数组创建向量
4195
+ * @param array - 数组
4196
+ * @param [offset=0] - 起始偏移值
4197
+ * @returns 向量
4198
+ */ _proto.setFromArray = function setFromArray(array, offset) {
4199
+ if (offset === void 0) offset = 0;
4200
+ var _array_offset;
4201
+ this.x = (_array_offset = array[offset]) != null ? _array_offset : 0;
4202
+ var _array_;
4203
+ this.y = (_array_ = array[offset + 1]) != null ? _array_ : 0;
4204
+ var _array_1;
4205
+ this.z = (_array_1 = array[offset + 2]) != null ? _array_1 : 0;
4206
+ var _array_2;
4207
+ this.w = (_array_2 = array[offset + 3]) != null ? _array_2 : 0;
4208
+ return this;
4209
+ };
4210
+ /**
4211
+ * 拷贝向量
4212
+ * @param v - 复制对象
4213
+ * @returns 拷贝结果
4214
+ */ _proto.copyFrom = function copyFrom(v) {
4215
+ this.x = v.x;
4216
+ this.y = v.y;
4217
+ this.z = v.z;
4218
+ this.w = v.w;
4219
+ return this;
4220
+ };
4221
+ /**
4222
+ * 克隆向量
4223
+ * @returns 克隆结果
4224
+ */ _proto.clone = function clone() {
4225
+ return new Vector4(this.x, this.y, this.z, this.w);
4226
+ };
4227
+ /**
4228
+ * 根据下标设置向量分量
4229
+ * @param index - 下标值
4230
+ * @param value - 分量值
4231
+ * @returns 向量
4232
+ */ _proto.setElement = function setElement(index, value) {
4233
+ switch(index){
4234
+ case 0:
4235
+ this.x = value;
4236
+ break;
4237
+ case 1:
4238
+ this.y = value;
4239
+ break;
4240
+ case 2:
4241
+ this.z = value;
4242
+ break;
4243
+ case 3:
4244
+ this.w = value;
4245
+ break;
4246
+ default:
4247
+ console.error("index is out of range: " + index);
4248
+ }
4249
+ return this;
4250
+ };
4251
+ /**
4252
+ * 根据下标获取向量分量
4253
+ * @param index - 下标
4254
+ * @returns 分量值
4255
+ */ _proto.getElement = function getElement(index) {
4256
+ switch(index){
4257
+ case 0:
4258
+ return this.x;
4259
+ case 1:
4260
+ return this.y;
4261
+ case 2:
4262
+ return this.z;
4263
+ case 3:
4264
+ return this.w;
4265
+ default:
4266
+ console.error("index is out of range: " + index);
4267
+ }
4268
+ return 0;
4269
+ };
4270
+ /**
4271
+ * 向量相加
4272
+ * @param right - 相加对象,向量 | 数字
4273
+ * @returns 相加结果
4274
+ */ _proto.add = function add(right) {
4275
+ if (typeof right === "number") {
4276
+ this.x += right;
4277
+ this.y += right;
4278
+ this.z += right;
4279
+ this.w += right;
4280
+ } else if (_instanceof1(right, Array)) {
4281
+ this.x += right[0];
4282
+ this.y += right[1];
4283
+ this.z += right[2];
4284
+ this.w += right[3];
4285
+ } else {
4286
+ this.x += right.x;
4287
+ this.y += right.y;
4288
+ this.z += right.z;
4289
+ this.w += right.w;
4290
+ }
4291
+ return this;
4292
+ };
4293
+ /**
4294
+ * 向量相加
4295
+ * @param left - 向量
4296
+ * @param right - 向量
4297
+ * @returns 求和结果
4298
+ */ _proto.addVectors = function addVectors(left, right) {
4299
+ this.x = left.x + right.x;
4300
+ this.y = left.y + right.y;
4301
+ this.z = left.z + right.z;
4302
+ this.w = left.w + right.w;
4303
+ return this;
4304
+ };
4305
+ /**
4306
+ * 向量比例缩放后相加
4307
+ * @param right - 向量
4308
+ * @param s - 比例
4309
+ * @returns 求和结果
4310
+ */ _proto.addScaledVector = function addScaledVector(right, s) {
4311
+ this.x += right.x * s;
4312
+ this.y += right.y * s;
4313
+ this.z += right.z * s;
4314
+ this.w += right.w * s;
4315
+ return this;
4316
+ };
4317
+ /**
4318
+ * 向量相减
4319
+ * @param right - 相减对象,向量 | 数字
4320
+ * @returns 相减结果
4321
+ */ _proto.subtract = function subtract(right) {
4322
+ if (typeof right === "number") {
4323
+ this.x -= right;
4324
+ this.y -= right;
4325
+ this.z -= right;
4326
+ this.w -= right;
4327
+ } else if (_instanceof1(right, Array)) {
4328
+ this.x -= right[0];
4329
+ this.y -= right[1];
4330
+ this.z -= right[2];
4331
+ this.w -= right[3];
4332
+ } else {
4333
+ this.x -= right.x;
4334
+ this.y -= right.y;
4335
+ this.z -= right.z;
4336
+ this.w -= right.w;
4337
+ }
4338
+ return this;
4339
+ };
4340
+ /**
4341
+ * 向量相减
4342
+ * @param left - 向量
4343
+ * @param right - 向量
4344
+ * @returns 向量
4345
+ */ _proto.subtractVectors = function subtractVectors(left, right) {
4346
+ this.x = left.x - right.x;
4347
+ this.y = left.y - right.y;
4348
+ this.z = left.z - right.z;
4349
+ this.w = left.w - right.w;
4350
+ return this;
4351
+ };
4352
+ /**
4353
+ * 向量相乘
4354
+ * @param right - 相乘对象,对象 | 数字
4355
+ * @returns 向量
4356
+ */ _proto.multiply = function multiply(right) {
4357
+ if (typeof right === "number") {
4358
+ this.x *= right;
4359
+ this.y *= right;
4360
+ this.z *= right;
4361
+ this.w *= right;
4362
+ } else if (_instanceof1(right, Array)) {
4363
+ this.x *= right[0];
4364
+ this.y *= right[1];
4365
+ this.z *= right[2];
4366
+ this.w *= right[3];
4367
+ } else {
4368
+ this.x *= right.x;
4369
+ this.y *= right.y;
4370
+ this.z *= right.z;
4371
+ this.w *= right.w;
4372
+ }
4373
+ return this;
4374
+ };
4375
+ /**
4376
+ * 向量相乘
4377
+ * @param left - 向量
4378
+ * @param right - 向量
4379
+ * @returns 向量
4380
+ */ _proto.multiplyVectors = function multiplyVectors(left, right) {
4381
+ this.x = left.x * right.x;
4382
+ this.y = left.y * right.y;
4383
+ this.z = left.z * right.z;
4384
+ this.w = left.w * right.w;
4385
+ return this;
4386
+ };
4387
+ /**
4388
+ * 向量相除
4389
+ * @param right - 相除对象,对象 | 数字
4390
+ * @returns 向量
4391
+ */ _proto.divide = function divide(right) {
4392
+ if (typeof right === "number") {
4393
+ this.x /= right;
4394
+ this.y /= right;
4395
+ this.z /= right;
4396
+ this.w /= right;
4397
+ } else if (_instanceof1(right, Array)) {
4398
+ this.x /= right[0];
4399
+ this.y /= right[1];
4400
+ this.z /= right[2];
4401
+ this.w /= right[3];
4402
+ } else {
4403
+ this.x /= right.x;
4404
+ this.y /= right.y;
4405
+ this.z /= right.z;
4406
+ this.w /= right.w;
4407
+ }
4408
+ return this;
4409
+ };
4410
+ /**
4411
+ * 向量缩放
4412
+ * @param v - 数字
4413
+ * @returns 缩放结果
4414
+ */ _proto.scale = function scale(v) {
4415
+ this.x *= v;
4416
+ this.y *= v;
4417
+ this.z *= v;
4418
+ this.w *= v;
4419
+ return this;
4420
+ };
4421
+ /**
4422
+ * 分量求和
4423
+ * @returns 求和结果
4424
+ */ _proto.sum = function sum() {
4425
+ return this.x + this.y + this.z + this.w;
4426
+ };
4427
+ /**
4428
+ * 向量求最小值
4429
+ * @param v - 向量或数值
4430
+ * @returns 最小值
4431
+ */ _proto.min = function min(v) {
4432
+ if (typeof v === "number") {
4433
+ this.x = Math.min(this.x, v);
4434
+ this.y = Math.min(this.y, v);
4435
+ this.z = Math.min(this.z, v);
4436
+ this.w = Math.min(this.w, v);
4437
+ } else {
4438
+ this.x = Math.min(this.x, v.x);
4439
+ this.y = Math.min(this.y, v.y);
4440
+ this.z = Math.min(this.z, v.z);
4441
+ this.w = Math.min(this.w, v.w);
4442
+ }
4443
+ return this;
4444
+ };
4445
+ /**
4446
+ * 向量求最大值
4447
+ * @param v - 向量或数值
4448
+ * @returns 最大值
4449
+ */ _proto.max = function max(v) {
4450
+ if (typeof v === "number") {
4451
+ this.x = Math.max(this.x, v);
4452
+ this.y = Math.max(this.y, v);
4453
+ this.z = Math.max(this.z, v);
4454
+ this.w = Math.max(this.w, v);
4455
+ } else {
4456
+ this.x = Math.max(this.x, v.x);
4457
+ this.y = Math.max(this.y, v.y);
4458
+ this.z = Math.max(this.z, v.z);
4459
+ this.w = Math.max(this.w, v.w);
4460
+ }
4461
+ return this;
4462
+ };
4463
+ /**
4464
+ * 向量阈值约束
4465
+ * @param min - 最小值
4466
+ * @param max - 最大值
4467
+ * @returns 向量
4468
+ */ _proto.clamp = function clamp(min, max) {
4469
+ return this.max(min).min(max);
4470
+ };
4471
+ /**
4472
+ * 向量向下取整
4473
+ * @returns 取整结果
4474
+ */ _proto.floor = function floor() {
4475
+ this.x = Math.floor(this.x);
4476
+ this.y = Math.floor(this.y);
4477
+ this.z = Math.floor(this.z);
4478
+ this.w = Math.floor(this.w);
4479
+ return this;
4480
+ };
4481
+ /**
4482
+ * 向量向上取整
4483
+ * @returns 取整结果
4484
+ */ _proto.ceil = function ceil() {
4485
+ this.x = Math.ceil(this.x);
4486
+ this.y = Math.ceil(this.y);
4487
+ this.z = Math.ceil(this.z);
4488
+ this.w = Math.ceil(this.w);
4489
+ return this;
4490
+ };
4491
+ /**
4492
+ * 向量四舍五入
4493
+ * @returns 求值结果
4494
+ */ _proto.round = function round() {
4495
+ this.x = Math.round(this.x);
4496
+ this.y = Math.round(this.y);
4497
+ this.z = Math.round(this.z);
4498
+ this.w = Math.round(this.w);
4499
+ return this;
4500
+ };
4501
+ /**
4502
+ * 向量取绝对值
4503
+ * @returns 向量
4504
+ */ _proto.abs = function abs() {
4505
+ this.x = Math.abs(this.x);
4506
+ this.y = Math.abs(this.y);
4507
+ this.z = Math.abs(this.z);
4508
+ this.w = Math.abs(this.w);
4509
+ return this;
4510
+ };
4511
+ /**
4512
+ * 向量取反
4513
+ * @returns 取反结果
4514
+ */ _proto.negate = function negate() {
4515
+ this.x = -this.x;
4516
+ this.y = -this.y;
4517
+ this.z = -this.z;
4518
+ this.w = -this.w;
4519
+ return this;
4520
+ };
4521
+ /**
4522
+ * 向量长度平方
4523
+ * @returns 长度平方
4524
+ */ _proto.lengthSquared = function lengthSquared() {
4525
+ return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
4526
+ };
4527
+ /**
4528
+ * 向量长度
4529
+ * @returns 长度
4530
+ */ _proto.length = function length() {
4531
+ return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
4532
+ };
4533
+ /**
4534
+ * 向量归一化
4535
+ * @returns 归一化结果
4536
+ */ _proto.normalize = function normalize() {
4537
+ return this.divide(this.length() || 1);
4538
+ };
4539
+ /**
4540
+ * 设置向量长度
4541
+ * @param length - 长度
4542
+ * @returns 向量
4543
+ */ _proto.setLength = function setLength(length) {
4544
+ return this.normalize().multiply(length);
4545
+ };
4546
+ /**
4547
+ * 向量求线性插值
4548
+ * @param v - 向量
4549
+ * @param alpha - 插值比例
4550
+ * @returns 插值结果
4551
+ */ _proto.lerp = function lerp(v, alpha) {
4552
+ this.x += (v.x - this.x) * alpha;
4553
+ this.y += (v.y - this.y) * alpha;
4554
+ this.z += (v.z - this.z) * alpha;
4555
+ this.w += (v.w - this.w) * alpha;
4556
+ return this;
4557
+ };
4558
+ /**
4559
+ * 两向量求线性插值
4560
+ * @param v1 - 第一个向量
4561
+ * @param v2 - 第二个向量
4562
+ * @param alpha - 插值比例
4563
+ * @returns 插值结果
4564
+ */ _proto.lerpVectors = function lerpVectors(v1, v2, alpha) {
4565
+ this.x = v1.x + (v2.x - v1.x) * alpha;
4566
+ this.y = v1.y + (v2.y - v1.y) * alpha;
4567
+ this.z = v1.z + (v2.z - v1.z) * alpha;
4568
+ this.w = v1.w + (v2.w - v1.w) * alpha;
4569
+ return this;
4570
+ };
4571
+ /**
4572
+ * 向量求点积
4573
+ * @param v - 向量
4574
+ * @returns 点积结果
4575
+ */ _proto.dot = function dot(v) {
4576
+ return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;
4577
+ };
4578
+ /**
4579
+ * 向量判等
4580
+ * @param v - 向量
4581
+ * @returns 判等结果
4582
+ */ _proto.equals = function equals(v) {
4583
+ return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w;
4584
+ };
4585
+ /**
4586
+ * 是否零向量
4587
+ * @returns 是否零向量
4588
+ */ _proto.isZero = function isZero() {
4589
+ var eps = NumberEpsilon;
4590
+ var _this = this, x = _this.x, y = _this.y, z = _this.z, w = _this.w;
4591
+ return Math.abs(x) <= eps && Math.abs(y) <= eps && Math.abs(z) <= eps && Math.abs(w) <= eps;
4592
+ };
4593
+ /**
4594
+ * 向量转数组
4595
+ * @returns 数组
4596
+ */ _proto.toArray = function toArray() {
4597
+ return [
4598
+ this.x,
4599
+ this.y,
4600
+ this.z,
4601
+ this.w
4602
+ ];
4603
+ };
4604
+ _proto.toVector3 = function toVector3() {
4605
+ return new Vector3(this.x, this.y, this.z);
4606
+ };
4607
+ _proto.fill = function fill(array, offset) {
4608
+ if (offset === void 0) offset = 0;
4609
+ array[offset] = this.x;
4610
+ array[offset + 1] = this.y;
4611
+ array[offset + 2] = this.z;
4612
+ array[offset + 3] = this.w;
4613
+ };
4614
+ /**
4615
+ * 生成随机向量
4616
+ * @returns 向量
4617
+ */ _proto.random = function random() {
4618
+ this.x = Math.random();
4619
+ this.y = Math.random();
4620
+ this.z = Math.random();
4621
+ this.w = Math.random();
4622
+ return this;
4623
+ };
4624
+ /**
4625
+ * 变换矩阵作用于向量
4626
+ * @param m - 变换矩阵
4627
+ * @param [out] - 输出结果,如果没有设置就直接覆盖当前值
4628
+ * @returns 向量
4629
+ */ _proto.applyMatrix = function applyMatrix(m, out) {
4630
+ return m.transformVector4(this, out);
4631
+ };
4632
+ /**
4633
+ * 通过标量数值创建向量
4634
+ * @param num - 数值
4635
+ * @returns 向量
4636
+ */ Vector4.fromNumber = function fromNumber(num) {
4637
+ return new Vector4().setFromNumber(num);
4638
+ };
4639
+ /**
4640
+ * 通过数组创建向量
4641
+ * @param array - 数组
4642
+ * @param [offset=0] - 起始偏移值
4643
+ * @returns 向量
4644
+ */ Vector4.fromArray = function fromArray(array, offset) {
4645
+ if (offset === void 0) offset = 0;
4646
+ return new Vector4().setFromArray(array, offset);
4647
+ };
4648
+ return Vector4;
4649
+ }();
4650
+ /**
4651
+ * 四维向量的常量
4652
+ */ Vector4.ONE = new Vector4(1.0, 1.0, 1.0, 1.0);
4653
+ Vector4.ZERO = new Vector4(0.0, 0.0, 0.0, 0.0);
4654
+
4655
+ var Color = /*#__PURE__*/ function() {
4656
+ function Color(r, g, b, a) {
4657
+ if (r === void 0) r = 0;
4658
+ if (g === void 0) g = 0;
4659
+ if (b === void 0) b = 0;
4660
+ if (a === void 0) a = 0;
4661
+ this.r = r;
4662
+ this.g = g;
4663
+ this.b = b;
4664
+ this.a = a;
4665
+ }
4666
+ var _proto = Color.prototype;
4667
+ /**
4668
+ * 设置颜色
4669
+ * @param r - r 分量
4670
+ * @param g - g 分量
4671
+ * @param b - b 分量
4672
+ * @param a - a 分量
4673
+ * @returns
4674
+ */ _proto.set = function set(r, g, b, a) {
4675
+ this.r = r;
4676
+ this.g = g;
4677
+ this.b = b;
4678
+ this.a = a;
4679
+ return this;
4680
+ };
4681
+ /**
4682
+ * 设置零颜色
4683
+ * @returns
4684
+ */ _proto.setZero = function setZero() {
4685
+ this.r = 0;
4686
+ this.g = 0;
4687
+ this.b = 0;
4688
+ this.a = 0;
4689
+ return this;
4690
+ };
4691
+ /**
4692
+ * 通过标量数值设置颜色
4693
+ * @param num - 数值
4694
+ * @returns
4695
+ */ _proto.setFromNumber = function setFromNumber(num) {
4696
+ this.r = num;
4697
+ this.g = num;
4698
+ this.b = num;
4699
+ this.a = num;
4700
+ return this;
4701
+ };
4702
+ /**
4703
+ * 通过Vector4创建颜色
4704
+ * @param v - Vector4
4705
+ * @returns
4706
+ */ _proto.setFromVector4 = function setFromVector4(v) {
4707
+ this.r = v.x;
4708
+ this.g = v.y;
4709
+ this.b = v.z;
4710
+ this.a = v.w;
4711
+ return this;
4712
+ };
4713
+ /**
4714
+ * 通过数组创建颜色
4715
+ * @param array - 数组
4716
+ * @param [offset=0] - 起始偏移值
4717
+ * @returns
4718
+ */ _proto.setFromArray = function setFromArray(array, offset) {
4719
+ if (offset === void 0) offset = 0;
4720
+ var _array_offset;
4721
+ this.r = (_array_offset = array[offset]) != null ? _array_offset : 0;
4722
+ var _array_;
4723
+ this.g = (_array_ = array[offset + 1]) != null ? _array_ : 0;
4724
+ var _array_1;
4725
+ this.b = (_array_1 = array[offset + 2]) != null ? _array_1 : 0;
4726
+ var _array_2;
4727
+ this.a = (_array_2 = array[offset + 3]) != null ? _array_2 : 0;
4728
+ return this;
4729
+ };
4730
+ _proto.setFromHSV = function setFromHSV(hue, saturation, value, alpha) {
4731
+ if (alpha === void 0) alpha = 1;
4732
+ var chroma = value * saturation;
4733
+ var h = hue / 60;
4734
+ var x = chroma * (1 - Math.abs(h % 2 - 1));
4735
+ var r = 0;
4736
+ var g = 0;
4737
+ var b = 0;
4738
+ if (h >= 0 && h <= 1) {
4739
+ r = chroma;
4740
+ g = x;
4741
+ } else if (h >= 1 && h <= 2) {
4742
+ r = x;
4743
+ g = chroma;
4744
+ } else if (h >= 2 && h <= 3) {
4745
+ g = chroma;
4746
+ b = x;
4747
+ } else if (h >= 3 && h <= 4) {
4748
+ g = x;
4749
+ b = chroma;
4750
+ } else if (h >= 4 && h <= 5) {
4751
+ r = x;
4752
+ b = chroma;
4753
+ } else if (h >= 5 && h <= 6) {
4754
+ r = chroma;
4755
+ b = x;
4756
+ }
4757
+ var m = value - chroma;
4758
+ return this.set(r + m, g + m, b + m, alpha);
4759
+ };
4760
+ _proto.setFromHexString = function setFromHexString(hex) {
4761
+ if (hex.substring(0, 1) !== "#" || hex.length !== 9 && hex.length !== 7) {
4762
+ return this;
4763
+ }
4764
+ var r = parseInt(hex.substring(1, 3), 16) / 255.0;
4765
+ var g = parseInt(hex.substring(3, 5), 16) / 255.0;
4766
+ var b = parseInt(hex.substring(5, 7), 16) / 255.0;
4767
+ var a = hex.length === 9 ? parseInt(hex.substring(7, 9), 16) / 255.0 : 1.0;
4768
+ return this.set(r, g, b, a);
4769
+ };
4770
+ /**
4771
+ * 拷贝颜色
4772
+ * @param v - 复制对象
4773
+ * @returns 拷贝结果
4774
+ */ _proto.copyFrom = function copyFrom(v) {
4775
+ this.r = v.r;
4776
+ this.g = v.g;
4777
+ this.b = v.b;
4778
+ this.a = v.a;
4779
+ return this;
4780
+ };
4781
+ /**
4782
+ * 克隆颜色
4783
+ * @returns 克隆结果
4784
+ */ _proto.clone = function clone() {
4785
+ return new Color(this.r, this.g, this.b, this.a);
4786
+ };
4787
+ /**
4788
+ * 根据下标设置颜色分量
4789
+ * @param index - 下标值
4790
+ * @param value - 分量值
4791
+ * @returns
4792
+ */ _proto.setElement = function setElement(index, value) {
4793
+ switch(index){
4794
+ case 0:
4795
+ this.r = value;
4796
+ break;
4797
+ case 1:
4798
+ this.g = value;
4799
+ break;
4800
+ case 2:
4801
+ this.b = value;
4802
+ break;
4803
+ case 3:
4804
+ this.a = value;
4805
+ break;
4806
+ default:
4807
+ console.error("index is out of range: " + index);
4808
+ }
4809
+ return this;
4810
+ };
4811
+ /**
4812
+ * 根据下标获取颜色分量
4813
+ * @param index - 下标
4814
+ * @returns 分量值
4815
+ */ _proto.getElement = function getElement(index) {
4816
+ switch(index){
4817
+ case 0:
4818
+ return this.r;
4819
+ case 1:
4820
+ return this.g;
4821
+ case 2:
4822
+ return this.b;
4823
+ case 3:
4824
+ return this.a;
4825
+ default:
4826
+ console.error("index is out of range: " + index);
4827
+ }
4828
+ return 0;
4829
+ };
4830
+ /**
4831
+ * 颜色相加
4832
+ * @param right - 相加对象,颜色 | 数字
4833
+ * @returns 相加结果
4834
+ */ _proto.add = function add(right) {
4835
+ if (typeof right === "number") {
4836
+ this.r += right;
4837
+ this.g += right;
4838
+ this.b += right;
4839
+ this.a += right;
4840
+ } else if (_instanceof1(right, Array)) {
4841
+ this.r += right[0];
4842
+ this.g += right[1];
4843
+ this.b += right[2];
4844
+ this.a += right[3];
4845
+ } else {
4846
+ this.r += right.r;
4847
+ this.g += right.g;
4848
+ this.b += right.b;
4849
+ this.a += right.a;
4850
+ }
4851
+ return this;
4852
+ };
4853
+ /**
4854
+ * 颜色相减
4855
+ * @param right - 相减对象,颜色 | 数字
4856
+ * @returns 相减结果
4857
+ */ _proto.subtract = function subtract(right) {
4858
+ if (typeof right === "number") {
4859
+ this.r -= right;
4860
+ this.g -= right;
4861
+ this.b -= right;
4862
+ this.a -= right;
4863
+ } else if (_instanceof1(right, Array)) {
4864
+ this.r -= right[0];
4865
+ this.g -= right[1];
4866
+ this.b -= right[2];
4867
+ this.a -= right[3];
4868
+ } else {
4869
+ this.r -= right.r;
4870
+ this.g -= right.g;
4871
+ this.b -= right.b;
4872
+ this.a -= right.a;
4873
+ }
4874
+ return this;
4875
+ };
4876
+ /**
4877
+ * 颜色相乘
4878
+ * @param right - 相乘对象,对象 | 数字
4879
+ * @returns 颜色
4880
+ */ _proto.multiply = function multiply(right) {
4881
+ if (typeof right === "number") {
4882
+ this.r *= right;
4883
+ this.g *= right;
4884
+ this.b *= right;
4885
+ this.a *= right;
4886
+ } else if (_instanceof1(right, Array)) {
4887
+ this.r *= right[0];
4888
+ this.g *= right[1];
4889
+ this.b *= right[2];
4890
+ this.a *= right[3];
4891
+ } else {
4892
+ this.r *= right.r;
4893
+ this.g *= right.g;
4894
+ this.b *= right.b;
4895
+ this.a *= right.a;
4896
+ }
4897
+ return this;
4898
+ };
4899
+ /**
4900
+ * 颜色相除
4901
+ * @param right - 相除对象,对象 | 数字
4902
+ * @returns 颜色
4903
+ */ _proto.divide = function divide(right) {
4904
+ if (typeof right === "number") {
4905
+ this.r /= right;
4906
+ this.g /= right;
4907
+ this.b /= right;
4908
+ this.a /= right;
4909
+ } else if (_instanceof1(right, Array)) {
4910
+ this.r /= right[0];
4911
+ this.g /= right[1];
4912
+ this.b /= right[2];
4913
+ this.a /= right[3];
4914
+ } else {
4915
+ this.r /= right.r;
4916
+ this.g /= right.g;
4917
+ this.b /= right.b;
4918
+ this.a /= right.a;
4919
+ }
4920
+ return this;
4921
+ };
4922
+ /**
4923
+ * 颜色缩放
4924
+ * @param v - 数字
4925
+ * @returns 缩放结果
4926
+ */ _proto.scale = function scale(v) {
4927
+ this.r *= v;
4928
+ this.g *= v;
4929
+ this.b *= v;
4930
+ this.a *= v;
4931
+ return this;
4932
+ };
4933
+ /**
4934
+ * 颜色求最小值
4935
+ * @param v - 颜色或数值
4936
+ * @returns 最小值
4937
+ */ _proto.min = function min(v) {
4938
+ if (typeof v === "number") {
4939
+ this.r = Math.min(this.r, v);
4940
+ this.g = Math.min(this.g, v);
4941
+ this.b = Math.min(this.b, v);
4942
+ this.a = Math.min(this.a, v);
4943
+ } else {
4944
+ this.r = Math.min(this.r, v.r);
4945
+ this.g = Math.min(this.g, v.g);
4946
+ this.b = Math.min(this.b, v.b);
4947
+ this.a = Math.min(this.a, v.a);
4948
+ }
4949
+ return this;
4950
+ };
4951
+ /**
4952
+ * 颜色求最大值
4953
+ * @param v - 颜色或数值
4954
+ * @returns 最大值
4955
+ */ _proto.max = function max(v) {
4956
+ if (typeof v === "number") {
4957
+ this.r = Math.max(this.r, v);
4958
+ this.g = Math.max(this.g, v);
4959
+ this.b = Math.max(this.b, v);
4960
+ this.a = Math.max(this.a, v);
4961
+ } else {
4962
+ this.r = Math.max(this.r, v.r);
4963
+ this.g = Math.max(this.g, v.g);
4964
+ this.b = Math.max(this.b, v.b);
4965
+ this.a = Math.max(this.a, v.a);
4966
+ }
4967
+ return this;
4968
+ };
4969
+ /**
4970
+ * 颜色阈值约束
4971
+ * @param min - 最小值
4972
+ * @param max - 最大值
4973
+ * @returns 颜色
4974
+ */ _proto.clamp = function clamp(min, max) {
4975
+ return this.max(min).min(max);
4976
+ };
4977
+ /**
4978
+ * 颜色求线性插值
4979
+ * @param v - 颜色
4980
+ * @param alpha - 插值比例
4981
+ * @returns 插值结果
4982
+ */ _proto.lerp = function lerp(v, alpha) {
4983
+ this.r += (v.r - this.r) * alpha;
4984
+ this.g += (v.g - this.g) * alpha;
4985
+ this.b += (v.b - this.b) * alpha;
4986
+ this.a += (v.a - this.a) * alpha;
4987
+ return this;
4988
+ };
4989
+ /**
4990
+ * 计算颜色亮度值
4991
+ * @returns 亮度值
4992
+ */ _proto.luminance = function luminance() {
4993
+ return this.r * 0.3 + this.g * 0.59 + this.b * 0.11;
4994
+ };
4995
+ /**
4996
+ * 颜色判等
4997
+ * @param v - 颜色
4998
+ * @returns 判等结果
4999
+ */ _proto.equals = function equals(v) {
5000
+ return v.r === this.r && v.g === this.g && v.b === this.b && v.a === this.a;
5001
+ };
5002
+ _proto.toLinear = function toLinear() {
5003
+ this.r = Color.gammaToLinear(this.r);
5004
+ this.g = Color.gammaToLinear(this.g);
5005
+ this.b = Color.gammaToLinear(this.b);
5006
+ return this;
5007
+ };
5008
+ _proto.toGamma = function toGamma() {
5009
+ this.r = Color.linearToGamma(this.r);
5010
+ this.g = Color.linearToGamma(this.g);
5011
+ this.b = Color.linearToGamma(this.b);
5012
+ return this;
5013
+ };
5014
+ /**
5015
+ * 颜色转数组
5016
+ * @returns 数组
5017
+ */ _proto.toArray = function toArray() {
5018
+ return [
5019
+ this.r,
5020
+ this.g,
5021
+ this.b,
5022
+ this.a
5023
+ ];
5024
+ };
5025
+ _proto.toVector4 = function toVector4() {
5026
+ return new Vector4(this.r, this.g, this.b, this.a);
5027
+ };
5028
+ /**
5029
+ * RGB 颜色空间转 HSV
5030
+ * @param result HSV 值
5031
+ */ _proto.toHSV = function toHSV() {
5032
+ var _this = this, r = _this.r, g = _this.g, b = _this.b, a = _this.a;
5033
+ var max = Math.max(r, g, b);
5034
+ var min = Math.min(r, g, b);
5035
+ var v = max;
5036
+ var dm = max - min;
5037
+ var h = 0;
5038
+ var s = 0;
5039
+ if (max !== 0) {
5040
+ s = dm / max;
5041
+ }
5042
+ if (max != min) {
5043
+ if (max == r) {
5044
+ h = (g - b) / dm;
5045
+ if (g < b) {
5046
+ h += 6;
5047
+ }
5048
+ } else if (max == g) {
5049
+ h = (b - r) / dm + 2;
5050
+ } else if (max == b) {
5051
+ h = (r - g) / dm + 4;
5052
+ }
5053
+ h *= 60;
5054
+ }
5055
+ return new Color(h, s, v, a);
5056
+ };
5057
+ _proto.toHexString = function toHexString(includeAlpha) {
5058
+ if (includeAlpha === void 0) includeAlpha = true;
5059
+ var R = Color.ToHex(Math.round(this.r * 255));
5060
+ var G = Color.ToHex(Math.round(this.g * 255));
5061
+ var B = Color.ToHex(Math.round(this.b * 255));
5062
+ var A = Color.ToHex(Math.round(this.a * 255));
5063
+ if (includeAlpha) {
5064
+ return "#" + R + G + B + A;
5065
+ } else {
5066
+ return "#" + R + G + B;
5067
+ }
5068
+ };
5069
+ _proto.fill = function fill(array, offset) {
5070
+ if (offset === void 0) offset = 0;
5071
+ array[offset] = this.r;
5072
+ array[offset + 1] = this.g;
5073
+ array[offset + 2] = this.b;
5074
+ array[offset + 3] = this.a;
5075
+ };
5076
+ /**
5077
+ * 通过标量数值创建颜色
5078
+ * @param num - 数值
5079
+ * @returns
5080
+ */ Color.fromNumber = function fromNumber(num) {
5081
+ return new Color().setFromNumber(num);
5082
+ };
5083
+ /**
5084
+ * 通过数组创建颜色
5085
+ * @param array - 数组
5086
+ * @param [offset=0] - 起始偏移值
5087
+ * @returns
5088
+ */ Color.fromArray = function fromArray(array, offset) {
5089
+ if (offset === void 0) offset = 0;
5090
+ return new Color().setFromArray(array, offset);
5091
+ };
5092
+ /**
5093
+ * 通过 hex 字符串创建颜色
5094
+ * @param hex - hex 字符串
5095
+ * @returns
5096
+ */ Color.fromHexString = function fromHexString(hex) {
5097
+ return new Color().setFromHexString(hex);
5098
+ };
5099
+ Color.fromHSV = function fromHSV(hue, saturation, value, alpha) {
5100
+ if (alpha === void 0) alpha = 1;
5101
+ return new Color().setFromHSV(hue, saturation, value, alpha);
5102
+ };
5103
+ /**
5104
+ * 颜色值从 Gamma 空间转到线性空间
5105
+ * @param v - Gamma 空间颜色值
5106
+ * @returns 线性空间颜色值
5107
+ */ Color.gammaToLinear = function gammaToLinear(v) {
5108
+ if (v <= 0.0) {
5109
+ return 0.0;
5110
+ } else if (v <= 0.04045) {
5111
+ return v / 12.92;
5112
+ } else if (v < 1.0) {
5113
+ return Math.pow((v + 0.055) / 1.055, 2.4);
5114
+ } else {
5115
+ return Math.pow(v, 2.4);
5116
+ }
5117
+ };
5118
+ /**
5119
+ * 颜色值从线性空间转到 Gamma 空间
5120
+ * @param value - 线性空间颜色值
5121
+ * @returns Gamma 空间颜色值
5122
+ */ Color.linearToGamma = function linearToGamma(value) {
5123
+ if (value <= 0.0) {
5124
+ return 0.0;
5125
+ } else if (value < 0.0031308) {
5126
+ return 12.92 * value;
5127
+ } else if (value < 1.0) {
5128
+ return 1.055 * Math.pow(value, 0.41666) - 0.055;
5129
+ } else {
5130
+ return Math.pow(value, 0.41666);
5131
+ }
5132
+ };
5133
+ Color.ToHex = function ToHex(i) {
5134
+ var str = i.toString(16);
5135
+ if (i <= 15) {
5136
+ return ("0" + str).toUpperCase();
5137
+ }
5138
+ return str.toUpperCase();
5139
+ };
5140
+ return Color;
5141
+ }();
5142
+ /**
5143
+ * 颜色的常量
5144
+ */ Color.BLACK = new Color(0, 0, 0, 1) // 纯黑色
5145
+ ;
5146
+ Color.BLUE = new Color(0, 0, 1, 1) // 纯蓝色
5147
+ ;
5148
+ Color.CLEAR = new Color(0, 0, 0, 0) // 完全透明
5149
+ ;
5150
+ Color.CYAN = new Color(0, 1, 1, 1) // 青色
5151
+ ;
5152
+ Color.GRAY = new Color(0.5, 0.5, 0.5, 1) // 灰色
5153
+ ;
5154
+ Color.GREEN = new Color(0, 1, 0, 1) // 纯绿色
5155
+ ;
5156
+ Color.MAGENTA = new Color(1, 0, 1, 1) // 洋红色
5157
+ ;
5158
+ Color.RED = new Color(1, 0, 0, 1) // 纯红色
5159
+ ;
5160
+ Color.WHITE = new Color(1, 1, 1, 1) // 纯白色
5161
+ ;
5162
+ Color.YELLOW = new Color(1, 0.92, 0.016, 1) // 黄色
5163
+ ;
5164
+
4144
5165
  var NodeTransform = /*#__PURE__*/ function() {
4145
5166
  function NodeTransform(transform) {
4146
5167
  this.position = new Vector3();
@@ -4180,7 +5201,7 @@ var Pose = /*#__PURE__*/ function() {
4180
5201
  }
4181
5202
  for(var _iterator2 = _create_for_of_iterator_helper_loose(skeleton.defaultColorPropertyValues), _step2; !(_step2 = _iterator2()).done;){
4182
5203
  var defaultColor = _step2.value;
4183
- this.colorPropertyValues.push(defaultColor);
5204
+ this.colorPropertyValues.push(new Color().copyFrom(defaultColor));
4184
5205
  }
4185
5206
  }
4186
5207
  var _proto = Pose.prototype;
@@ -5596,1059 +6617,548 @@ var Skeleton = /*#__PURE__*/ function() {
5596
6617
  }
5597
6618
  var targetBone = this.findTarget(path);
5598
6619
  if (!targetBone) {
5599
- return;
5600
- }
5601
- this.parentSpaceTransforms.push(new NodeTransform(targetBone.transform));
5602
- this.animatedTransforms.push(targetBone.transform);
5603
- this.pathToBoneIndex.set(path, this.parentSpaceTransforms.length - 1);
5604
- };
5605
- _proto.addRecordedProperty = function addRecordedProperty(path, className, property, type) {
5606
- var totalPath = path + className + property;
5607
- if (this.pathToObjectIndex.get(totalPath) !== undefined) {
5608
- return;
5609
- }
5610
- var targetBone = this.findTarget(path);
5611
- if (!targetBone) {
5612
- return;
5613
- }
5614
- var animatedComponentOrItem;
5615
- // Find target component or VFXItem
5616
- if (className === VFXItemType) {
5617
- animatedComponentOrItem = targetBone;
5618
- } else {
5619
- animatedComponentOrItem = targetBone.getComponent(getClass(className));
5620
- }
5621
- if (!animatedComponentOrItem) {
5622
- console.error("The " + className + " Component was not found.");
5623
- }
5624
- // Find last animated object by path
5625
- var propertyNames = property.split(".");
5626
- var lastPropertyName = propertyNames[propertyNames.length - 1];
5627
- var target = animatedComponentOrItem;
5628
- for(var i = 0; i < propertyNames.length - 1; i++){
5629
- var _$property = target[propertyNames[i]];
5630
- if (_$property === undefined) {
5631
- console.error("The " + propertyNames[i] + " property of " + target + " was not found.");
5632
- }
5633
- target = _$property;
5634
- }
5635
- var animatedObject = {
5636
- target: target,
5637
- property: lastPropertyName
5638
- };
5639
- switch(type){
5640
- case 0:
5641
- this.floatAnimatedObjects.push(animatedObject);
5642
- this.defaultFloatPropertyValues.push(target[lastPropertyName]);
5643
- this.pathToObjectIndex.set(totalPath, this.floatAnimatedObjects.length - 1);
5644
- break;
5645
- case 1:
5646
- this.colorAnimatedObjects.push(animatedObject);
5647
- this.defaultColorPropertyValues.push(target[lastPropertyName]);
5648
- this.pathToObjectIndex.set(totalPath, this.colorAnimatedObjects.length - 1);
5649
- }
5650
- };
5651
- _proto.findTarget = function findTarget(boneName) {
5652
- if (boneName === "") {
5653
- return this.rootBone;
5654
- }
5655
- var itemNames = boneName.split("/");
5656
- var currentItem = this.rootBone;
5657
- for(var _iterator = _create_for_of_iterator_helper_loose(itemNames), _step; !(_step = _iterator()).done;){
5658
- var itemName = _step.value;
5659
- var target = currentItem.find(itemName);
5660
- if (!target) {
5661
- return null;
5662
- }
5663
- currentItem = target;
5664
- }
5665
- return currentItem;
5666
- };
5667
- return Skeleton;
5668
- }();
5669
-
5670
- var GraphInstance = /*#__PURE__*/ function() {
5671
- function GraphInstance(graphAsset, rootBone) {
5672
- this.graphAsset = graphAsset;
5673
- this.nodes = [];
5674
- this.context = new GraphContext();
5675
- // Initialize skeleton
5676
- var recordProperties = {
5677
- position: [],
5678
- scale: [],
5679
- rotation: [],
5680
- euler: [],
5681
- floats: [],
5682
- colors: []
5683
- };
5684
- for(var _iterator = _create_for_of_iterator_helper_loose(graphAsset.graphDataSet.resources), _step; !(_step = _iterator()).done;){
5685
- var animationClip = _step.value;
5686
- if (!animationClip) {
5687
- continue;
5688
- }
5689
- for(var _iterator1 = _create_for_of_iterator_helper_loose(animationClip.positionCurves), _step1; !(_step1 = _iterator1()).done;){
5690
- var positionCurve = _step1.value;
5691
- recordProperties.position.push(positionCurve.path);
5692
- }
5693
- for(var _iterator2 = _create_for_of_iterator_helper_loose(animationClip.rotationCurves), _step2; !(_step2 = _iterator2()).done;){
5694
- var rotationCurve = _step2.value;
5695
- recordProperties.rotation.push(rotationCurve.path);
5696
- }
5697
- for(var _iterator3 = _create_for_of_iterator_helper_loose(animationClip.scaleCurves), _step3; !(_step3 = _iterator3()).done;){
5698
- var scaleCurve = _step3.value;
5699
- recordProperties.scale.push(scaleCurve.path);
5700
- }
5701
- for(var _iterator4 = _create_for_of_iterator_helper_loose(animationClip.eulerCurves), _step4; !(_step4 = _iterator4()).done;){
5702
- var eulerCurve = _step4.value;
5703
- recordProperties.euler.push(eulerCurve.path);
5704
- }
5705
- for(var _iterator5 = _create_for_of_iterator_helper_loose(animationClip.floatCurves), _step5; !(_step5 = _iterator5()).done;){
5706
- var floatCurve = _step5.value;
5707
- recordProperties.floats.push(floatCurve);
5708
- }
5709
- for(var _iterator6 = _create_for_of_iterator_helper_loose(animationClip.colorCurves), _step6; !(_step6 = _iterator6()).done;){
5710
- var colorCurve = _step6.value;
5711
- recordProperties.colors.push(colorCurve);
5712
- }
5713
- }
5714
- this.skeleton = new Skeleton(rootBone, recordProperties);
5715
- // create PoseResult
5716
- this.result = new PoseResult(this.skeleton);
5717
- this.context.skeleton = this.skeleton;
5718
- // instantiate graph nodes
5719
- var instantiationContext = new InstantiationContext();
5720
- instantiationContext.nodes = this.nodes;
5721
- instantiationContext.nodeDatas = graphAsset.nodeDatas;
5722
- instantiationContext.dataSet = graphAsset.graphDataSet;
5723
- for(var i = 0; i < graphAsset.nodeDatas.length; i++){
5724
- if (!instantiationContext.nodes[i]) {
5725
- graphAsset.nodeDatas[i].instantiate(instantiationContext);
5726
- }
5727
- }
5728
- this.rootNode = this.nodes[graphAsset.rootNodeIndex];
5729
- }
5730
- var _proto = GraphInstance.prototype;
5731
- _proto.evaluateGraph = function evaluateGraph(deltaTime) {
5732
- this.context.update(deltaTime);
5733
- if (!this.rootNode.isInitialized()) {
5734
- this.resetGraphState();
5735
- }
5736
- // Evaluate the entire animation graph starting from the rootNode
5737
- if (this.rootNode) {
5738
- this.result = this.rootNode.evaluate(this.context, this.result);
5739
- }
5740
- // Reset trigger nodes
5741
- for(var i = 0; i < this.getNumControlParameters(); i++){
5742
- var controlParameterNode = this.nodes[i];
5743
- if (_instanceof1(controlParameterNode, ControlParameterTriggerNode)) {
5744
- controlParameterNode.setValue(false);
5745
- }
5746
- }
5747
- return this.result;
5748
- };
5749
- _proto.isInitialized = function isInitialized() {
5750
- return this.rootNode && this.rootNode.isInitialized();
5751
- };
5752
- // General Node Info
5753
- //-------------------------------------------------------------------------
5754
- _proto.isNodeActive = function isNodeActive(nodeIdx) {
5755
- return this.isControlParameter(nodeIdx) || this.nodes[nodeIdx].isNodeActive(this.context.updateID);
5756
- };
5757
- // Graph State
5758
- //-------------------------------------------------------------------------
5759
- _proto.resetGraphState = function resetGraphState() {
5760
- if (this.rootNode.isInitialized()) {
5761
- this.rootNode.shutdown(this.context);
5762
- }
5763
- this.context.updateID++; // Bump the update ID to ensure that any initialization code that relies on it is dirtied.
5764
- this.rootNode.initialize(this.context);
5765
- };
5766
- // Control Parameters
5767
- //-------------------------------------------------------------------------
5768
- _proto.getNumControlParameters = function getNumControlParameters() {
5769
- return this.graphAsset.controlParameterIDs.length;
5770
- };
5771
- _proto.getControlParameterIndex = function getControlParameterIndex(parameterID) {
5772
- var parameterLookupMap = this.graphAsset.parameterLookupMap;
5773
- var res = parameterLookupMap.get(parameterID);
5774
- if (res !== undefined) {
5775
- return res;
5776
- }
5777
- console.warn("Parameter '" + parameterID + "' does not exist.");
5778
- return InvalidIndex;
5779
- };
5780
- _proto.getControlParameterID = function getControlParameterID(parameterNodeIndex) {
5781
- return this.graphAsset.controlParameterIDs[parameterNodeIndex];
5782
- };
5783
- _proto.setBool = function setBool(name, value) {
5784
- this.setControlParameterValue(name, value);
5785
- };
5786
- _proto.setFloat = function setFloat(name, value) {
5787
- this.setControlParameterValue(name, value);
5788
- };
5789
- _proto.setTrigger = function setTrigger(name) {
5790
- this.setControlParameterValue(name, true);
5791
- };
5792
- _proto.resetTrigger = function resetTrigger(name) {
5793
- this.setControlParameterValue(name, false);
5794
- };
5795
- // Debug Information
5796
- //-------------------------------------------------------------------------
5797
- _proto.getPoseNodeDebugInfo = function getPoseNodeDebugInfo(nodeIdx) {
5798
- var node = this.nodes[nodeIdx];
5799
- return node.getDebugInfo();
5800
- };
5801
- _proto.getRuntimeNodeDebugValue = function getRuntimeNodeDebugValue(nodeIdx) {
5802
- var valueNode = this.nodes[nodeIdx];
5803
- return valueNode.getValue(this.context);
5804
- };
5805
- _proto.getNodeDebugInstance = function getNodeDebugInstance(nodeIdx) {
5806
- return this.nodes[nodeIdx];
5807
- };
5808
- _proto.isControlParameter = function isControlParameter(nodeIdx) {
5809
- return nodeIdx < this.getNumControlParameters();
5810
- };
5811
- _proto.setControlParameterValue = function setControlParameterValue(name, value) {
5812
- var index = this.getControlParameterIndex(name);
5813
- if (index !== InvalidIndex) {
5814
- this.nodes[index].setValue(value);
5815
- }
5816
- };
5817
- return GraphInstance;
5818
- }();
5819
-
5820
- function _defineProperties(target, props) {
5821
- for(var i = 0; i < props.length; i++){
5822
- var descriptor = props[i];
5823
- descriptor.enumerable = descriptor.enumerable || false;
5824
- descriptor.configurable = true;
5825
- if ("value" in descriptor) descriptor.writable = true;
5826
- Object.defineProperty(target, descriptor.key, descriptor);
5827
- }
5828
- }
5829
- function _create_class(Constructor, protoProps, staticProps) {
5830
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
5831
- if (staticProps) _defineProperties(Constructor, staticProps);
5832
- return Constructor;
5833
- }
5834
-
5835
- /**
5836
- * @since 2.0.0
5837
- */ var Component = /*#__PURE__*/ function(EffectsObject) {
5838
- _inherits(Component, EffectsObject);
5839
- function Component() {
5840
- var _this;
5841
- _this = EffectsObject.apply(this, arguments) || this;
5842
- _this.isAwakeCalled = false;
5843
- _this.isStartCalled = false;
5844
- _this.isEnableCalled = false;
5845
- _this._enabled = true;
5846
- return _this;
5847
- }
5848
- var _proto = Component.prototype;
5849
- /**
5850
- * 生命周期函数,初始化后调用,生命周期内只调用一次
5851
- */ _proto.onAwake = function onAwake() {
5852
- // OVERRIDE
5853
- };
5854
- /**
5855
- * 在 enabled 变为 true 时触发
5856
- */ _proto.onEnable = function onEnable() {
5857
- // OVERRIDE
5858
- };
5859
- /**
5860
- * 在 enabled 变为 false 时触发
5861
- */ _proto.onDisable = function onDisable() {
5862
- // OVERRIDE
5863
- };
5864
- /**
5865
- * 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
5866
- */ _proto.onStart = function onStart() {
5867
- // OVERRIDE
5868
- };
5869
- /**
5870
- * 生命周期函数,每帧调用一次
5871
- */ _proto.onUpdate = function onUpdate(dt) {
5872
- // OVERRIDE
5873
- };
5874
- /**
5875
- * 生命周期函数,每帧调用一次,在 update 之后调用
5876
- */ _proto.onLateUpdate = function onLateUpdate(dt) {
5877
- // OVERRIDE
5878
- };
5879
- /**
5880
- * 生命周期函数,在组件销毁时调用
5881
- */ _proto.onDestroy = function onDestroy() {
5882
- // OVERRIDE
5883
- };
5884
- /**
5885
- * @internal
5886
- */ _proto.enable = function enable() {
5887
- if (this.item.composition) {
5888
- this.item.composition.sceneTicking.addComponent(this);
5889
- this.isEnableCalled = true;
5890
- }
5891
- this.onEnable();
5892
- };
5893
- /**
5894
- * @internal
5895
- */ _proto.disable = function disable() {
5896
- this.onDisable();
5897
- if (this.item.composition) {
5898
- this.isEnableCalled = false;
5899
- this.item.composition.sceneTicking.removeComponent(this);
5900
- }
5901
- };
5902
- _proto.setVFXItem = function setVFXItem(item) {
5903
- this.item = item;
5904
- if (item.isDuringPlay) {
5905
- if (!this.isAwakeCalled) {
5906
- this.onAwake();
5907
- this.isAwakeCalled = true;
5908
- }
5909
- if (item.isActive && this.enabled) {
5910
- this.start();
5911
- this.enable();
5912
- }
5913
- }
5914
- };
5915
- _proto.fromData = function fromData(data) {
5916
- EffectsObject.prototype.fromData.call(this, data);
5917
- };
5918
- _proto.dispose = function dispose() {
5919
- if (this.isEnableCalled) {
5920
- this.disable();
5921
- }
5922
- if (this.isAwakeCalled) {
5923
- this.isAwakeCalled = false;
5924
- this.onDestroy();
5925
- }
5926
- if (this.item) {
5927
- removeItem(this.item.components, this);
5928
- }
5929
- };
5930
- _proto.start = function start() {
5931
- if (this.isStartCalled) {
5932
- return;
5933
- }
5934
- this.isStartCalled = true;
5935
- this.onStart();
5936
- };
5937
- _create_class(Component, [
5938
- {
5939
- key: "transform",
5940
- get: /**
5941
- * 附加到的 VFXItem 对象 Transform 组件
5942
- */ function get() {
5943
- return this.item.transform;
5944
- }
5945
- },
5946
- {
5947
- key: "isActiveAndEnabled",
5948
- get: /**
5949
- * 组件是否可以更新,true 更新,false 不更新
5950
- */ function get() {
5951
- return this.item.isActive && this.enabled;
5952
- }
5953
- },
5954
- {
5955
- key: "enabled",
5956
- get: function get() {
5957
- return this._enabled;
5958
- },
5959
- set: function set(value) {
5960
- if (this.enabled !== value) {
5961
- this._enabled = value;
5962
- if (value) {
5963
- if (this.isActiveAndEnabled) {
5964
- this.enable();
5965
- if (!this.isStartCalled) {
5966
- this.onStart();
5967
- this.isStartCalled = true;
5968
- }
5969
- }
5970
- } else {
5971
- if (this.isEnableCalled) {
5972
- this.disable();
5973
- }
5974
- }
5975
- }
5976
- }
5977
- }
5978
- ]);
5979
- return Component;
5980
- }(EffectsObject);
5981
- __decorate([
5982
- serialize()
5983
- ], Component.prototype, "item", void 0);
5984
- __decorate([
5985
- serialize()
5986
- ], Component.prototype, "_enabled", void 0);
5987
- /**
5988
- * @since 2.0.0
5989
- * @deprecated 2.4.0 Please use Component instead
5990
- */ var Behaviour = /*#__PURE__*/ function(Component) {
5991
- _inherits(Behaviour, Component);
5992
- function Behaviour() {
5993
- return Component.apply(this, arguments);
5994
- }
5995
- var _proto = Behaviour.prototype;
5996
- _proto.setVFXItem = function setVFXItem(item) {
5997
- Component.prototype.setVFXItem.call(this, item);
5998
- };
5999
- _proto.dispose = function dispose() {
6000
- Component.prototype.dispose.call(this);
6001
- };
6002
- return Behaviour;
6003
- }(Component);
6004
-
6005
- var Animator = /*#__PURE__*/ function(Component) {
6006
- _inherits(Animator, Component);
6007
- function Animator() {
6008
- var _this;
6009
- _this = Component.apply(this, arguments) || this;
6010
- /**
6011
- * @internal
6012
- */ _this.graph = null;
6013
- _this.graphAsset = null;
6014
- return _this;
6015
- }
6016
- var _proto = Animator.prototype;
6017
- _proto.setBool = function setBool(name, value) {
6018
- if (this.graph) {
6019
- this.graph.setBool(name, value);
6020
- }
6021
- };
6022
- _proto.setFloat = function setFloat(name, value) {
6023
- if (this.graph) {
6024
- this.graph.setFloat(name, value);
6025
- }
6026
- };
6027
- _proto.setTrigger = function setTrigger(name) {
6028
- if (this.graph) {
6029
- this.graph.setTrigger(name);
6030
- }
6031
- };
6032
- _proto.resetTrigger = function resetTrigger(name) {
6033
- if (this.graph) {
6034
- this.graph.resetTrigger(name);
6620
+ return;
6035
6621
  }
6622
+ this.parentSpaceTransforms.push(new NodeTransform(targetBone.transform));
6623
+ this.animatedTransforms.push(targetBone.transform);
6624
+ this.pathToBoneIndex.set(path, this.parentSpaceTransforms.length - 1);
6036
6625
  };
6037
- _proto.onStart = function onStart() {
6038
- if (this.graphAsset) {
6039
- this.graph = new GraphInstance(this.graphAsset, this.item);
6626
+ _proto.addRecordedProperty = function addRecordedProperty(path, className, property, type) {
6627
+ var totalPath = path + className + property;
6628
+ if (this.pathToObjectIndex.get(totalPath) !== undefined) {
6629
+ return;
6040
6630
  }
6041
- };
6042
- _proto.onUpdate = function onUpdate(dt) {
6043
- if (!this.graph) {
6631
+ var targetBone = this.findTarget(path);
6632
+ if (!targetBone) {
6044
6633
  return;
6045
6634
  }
6046
- var result = this.graph.evaluateGraph(dt / 1000);
6047
- // Apply transform animation
6048
- //-------------------------------------------------------------------------
6049
- var animatedTransforms = this.graph.skeleton.animatedTransforms;
6050
- for(var i = 0; i < animatedTransforms.length; i++){
6051
- var position = result.pose.parentSpaceTransforms[i].position;
6052
- var rotation = result.pose.parentSpaceTransforms[i].rotation;
6053
- var scale = result.pose.parentSpaceTransforms[i].scale;
6054
- var euler = result.pose.parentSpaceTransforms[i].euler;
6055
- animatedTransforms[i].setPosition(position.x, position.y, position.z);
6056
- animatedTransforms[i].setScale(scale.x, scale.y, scale.z);
6057
- if (this.graph.skeleton.useEuler) {
6058
- animatedTransforms[i].setRotation(euler.x, euler.y, euler.z);
6059
- } else {
6060
- animatedTransforms[i].setQuaternion(rotation.x, rotation.y, rotation.z, rotation.w);
6061
- }
6635
+ var animatedComponentOrItem;
6636
+ // Find target component or VFXItem
6637
+ if (className === VFXItemType) {
6638
+ animatedComponentOrItem = targetBone;
6639
+ } else {
6640
+ animatedComponentOrItem = targetBone.getComponent(getClass(className));
6062
6641
  }
6063
- // Apply property animation
6064
- //-------------------------------------------------------------------------
6065
- var floatAnimatedObjects = this.graph.skeleton.floatAnimatedObjects;
6066
- for(var i1 = 0; i1 < floatAnimatedObjects.length; i1++){
6067
- var animatedObject = floatAnimatedObjects[i1];
6068
- var property = animatedObject.property;
6069
- animatedObject.target[property] = result.pose.floatPropertyValues[i1];
6642
+ if (!animatedComponentOrItem) {
6643
+ console.error("The " + className + " Component was not found.");
6070
6644
  }
6071
- var colorAnimatedObjects = this.graph.skeleton.colorAnimatedObjects;
6072
- for(var i2 = 0; i2 < colorAnimatedObjects.length; i2++){
6073
- var animatedObject1 = colorAnimatedObjects[i2];
6074
- var property1 = animatedObject1.property;
6075
- animatedObject1.target[property1] = result.pose.colorPropertyValues[i2];
6645
+ // Find last animated object by path
6646
+ var propertyNames = property.split(".");
6647
+ var lastPropertyName = propertyNames[propertyNames.length - 1];
6648
+ var target = animatedComponentOrItem;
6649
+ for(var i = 0; i < propertyNames.length - 1; i++){
6650
+ var _$property = target[propertyNames[i]];
6651
+ if (_$property === undefined) {
6652
+ console.error("The " + propertyNames[i] + " property of " + target + " was not found.");
6653
+ }
6654
+ target = _$property;
6655
+ }
6656
+ var animatedObject = {
6657
+ target: target,
6658
+ property: lastPropertyName
6659
+ };
6660
+ switch(type){
6661
+ case 0:
6662
+ this.floatAnimatedObjects.push(animatedObject);
6663
+ this.defaultFloatPropertyValues.push(target[lastPropertyName]);
6664
+ this.pathToObjectIndex.set(totalPath, this.floatAnimatedObjects.length - 1);
6665
+ break;
6666
+ case 1:
6667
+ this.colorAnimatedObjects.push(animatedObject);
6668
+ this.defaultColorPropertyValues.push(new Color().copyFrom(target[lastPropertyName]));
6669
+ this.pathToObjectIndex.set(totalPath, this.colorAnimatedObjects.length - 1);
6076
6670
  }
6077
6671
  };
6078
- _proto.fromData = function fromData(data) {
6079
- this.graphAsset = this.engine.findObject(data.graphAsset);
6672
+ _proto.findTarget = function findTarget(boneName) {
6673
+ if (boneName === "") {
6674
+ return this.rootBone;
6675
+ }
6676
+ var itemNames = boneName.split("/");
6677
+ var currentItem = this.rootBone;
6678
+ for(var _iterator = _create_for_of_iterator_helper_loose(itemNames), _step; !(_step = _iterator()).done;){
6679
+ var itemName = _step.value;
6680
+ var target = currentItem.find(itemName);
6681
+ if (!target) {
6682
+ return null;
6683
+ }
6684
+ currentItem = target;
6685
+ }
6686
+ return currentItem;
6080
6687
  };
6081
- return Animator;
6082
- }(Component);
6083
- Animator = __decorate([
6084
- effectsClass("Animator")
6085
- ], Animator);
6688
+ return Skeleton;
6689
+ }();
6086
6690
 
6087
- /**
6088
- * 所有渲染组件的基类
6089
- * @since 2.0.0
6090
- */ var RendererComponent = /*#__PURE__*/ function(Component) {
6091
- _inherits(RendererComponent, Component);
6092
- function RendererComponent() {
6093
- var _this;
6094
- _this = Component.apply(this, arguments) || this;
6095
- _this.materials = [];
6096
- _this._priority = 0;
6097
- return _this;
6098
- }
6099
- var _proto = RendererComponent.prototype;
6100
- _proto.render = function render(renderer) {};
6101
- _proto.onEnable = function onEnable() {
6102
- var _this_item_composition;
6103
- (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.addMeshToDefaultRenderPass(this);
6104
- };
6105
- _proto.onDisable = function onDisable() {
6106
- var _this_item_composition;
6107
- (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.removeMeshFromDefaultRenderPass(this);
6108
- };
6109
- _create_class(RendererComponent, [
6110
- {
6111
- key: "priority",
6112
- get: function get() {
6113
- return this._priority;
6114
- },
6115
- set: function set(value) {
6116
- this._priority = value;
6691
+ var GraphInstance = /*#__PURE__*/ function() {
6692
+ function GraphInstance(graphAsset, rootBone) {
6693
+ this.graphAsset = graphAsset;
6694
+ this.nodes = [];
6695
+ this.context = new GraphContext();
6696
+ // Initialize skeleton
6697
+ var recordProperties = {
6698
+ position: [],
6699
+ scale: [],
6700
+ rotation: [],
6701
+ euler: [],
6702
+ floats: [],
6703
+ colors: []
6704
+ };
6705
+ for(var _iterator = _create_for_of_iterator_helper_loose(graphAsset.graphDataSet.resources), _step; !(_step = _iterator()).done;){
6706
+ var animationClip = _step.value;
6707
+ if (!animationClip) {
6708
+ continue;
6117
6709
  }
6118
- },
6119
- {
6120
- key: "material",
6121
- get: function get() {
6122
- return this.materials[0];
6123
- },
6124
- set: function set(material) {
6125
- if (this.materials.length === 0) {
6126
- this.materials.push(material);
6127
- } else {
6128
- this.materials[0] = material;
6129
- }
6710
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(animationClip.positionCurves), _step1; !(_step1 = _iterator1()).done;){
6711
+ var positionCurve = _step1.value;
6712
+ recordProperties.position.push(positionCurve.path);
6713
+ }
6714
+ for(var _iterator2 = _create_for_of_iterator_helper_loose(animationClip.rotationCurves), _step2; !(_step2 = _iterator2()).done;){
6715
+ var rotationCurve = _step2.value;
6716
+ recordProperties.rotation.push(rotationCurve.path);
6717
+ }
6718
+ for(var _iterator3 = _create_for_of_iterator_helper_loose(animationClip.scaleCurves), _step3; !(_step3 = _iterator3()).done;){
6719
+ var scaleCurve = _step3.value;
6720
+ recordProperties.scale.push(scaleCurve.path);
6721
+ }
6722
+ for(var _iterator4 = _create_for_of_iterator_helper_loose(animationClip.eulerCurves), _step4; !(_step4 = _iterator4()).done;){
6723
+ var eulerCurve = _step4.value;
6724
+ recordProperties.euler.push(eulerCurve.path);
6725
+ }
6726
+ for(var _iterator5 = _create_for_of_iterator_helper_loose(animationClip.floatCurves), _step5; !(_step5 = _iterator5()).done;){
6727
+ var floatCurve = _step5.value;
6728
+ recordProperties.floats.push(floatCurve);
6729
+ }
6730
+ for(var _iterator6 = _create_for_of_iterator_helper_loose(animationClip.colorCurves), _step6; !(_step6 = _iterator6()).done;){
6731
+ var colorCurve = _step6.value;
6732
+ recordProperties.colors.push(colorCurve);
6130
6733
  }
6131
6734
  }
6132
- ]);
6133
- return RendererComponent;
6134
- }(Component);
6135
- __decorate([
6136
- serialize()
6137
- ], RendererComponent.prototype, "materials", void 0);
6138
- __decorate([
6139
- serialize()
6140
- ], RendererComponent.prototype, "_priority", void 0);
6141
-
6142
- /**
6143
- * 四维向量
6144
- */ var Vector4 = /*#__PURE__*/ function() {
6145
- function Vector4(x, y, z, w) {
6146
- if (x === void 0) x = 0;
6147
- if (y === void 0) y = 0;
6148
- if (z === void 0) z = 0;
6149
- if (w === void 0) w = 0;
6150
- this.x = x;
6151
- this.y = y;
6152
- this.z = z;
6153
- this.w = w;
6735
+ this.skeleton = new Skeleton(rootBone, recordProperties);
6736
+ // create PoseResult
6737
+ this.result = new PoseResult(this.skeleton);
6738
+ this.context.skeleton = this.skeleton;
6739
+ // instantiate graph nodes
6740
+ var instantiationContext = new InstantiationContext();
6741
+ instantiationContext.nodes = this.nodes;
6742
+ instantiationContext.nodeDatas = graphAsset.nodeDatas;
6743
+ instantiationContext.dataSet = graphAsset.graphDataSet;
6744
+ for(var i = 0; i < graphAsset.nodeDatas.length; i++){
6745
+ if (!instantiationContext.nodes[i]) {
6746
+ graphAsset.nodeDatas[i].instantiate(instantiationContext);
6747
+ }
6748
+ }
6749
+ this.rootNode = this.nodes[graphAsset.rootNodeIndex];
6154
6750
  }
6155
- var _proto = Vector4.prototype;
6156
- /**
6157
- * 设置向量
6158
- * @param x - x 轴分量
6159
- * @param y - y 轴分量
6160
- * @param z - z 轴分量
6161
- * @param w - w 轴分量
6162
- * @returns
6163
- */ _proto.set = function set(x, y, z, w) {
6164
- this.x = x;
6165
- this.y = y;
6166
- this.z = z;
6167
- this.w = w;
6168
- return this;
6169
- };
6170
- /**
6171
- * 设置零向量
6172
- * @returns 向量
6173
- */ _proto.setZero = function setZero() {
6174
- this.x = 0;
6175
- this.y = 0;
6176
- this.z = 0;
6177
- this.w = 0;
6178
- return this;
6179
- };
6180
- /**
6181
- * 通过标量数值设置向量
6182
- * @param num - 数值
6183
- * @returns 向量
6184
- */ _proto.setFromNumber = function setFromNumber(num) {
6185
- this.x = num;
6186
- this.y = num;
6187
- this.z = num;
6188
- this.w = num;
6189
- return this;
6190
- };
6191
- /**
6192
- * 通过数组创建向量
6193
- * @param array - 数组
6194
- * @param [offset=0] - 起始偏移值
6195
- * @returns 向量
6196
- */ _proto.setFromArray = function setFromArray(array, offset) {
6197
- if (offset === void 0) offset = 0;
6198
- var _array_offset;
6199
- this.x = (_array_offset = array[offset]) != null ? _array_offset : 0;
6200
- var _array_;
6201
- this.y = (_array_ = array[offset + 1]) != null ? _array_ : 0;
6202
- var _array_1;
6203
- this.z = (_array_1 = array[offset + 2]) != null ? _array_1 : 0;
6204
- var _array_2;
6205
- this.w = (_array_2 = array[offset + 3]) != null ? _array_2 : 0;
6206
- return this;
6751
+ var _proto = GraphInstance.prototype;
6752
+ _proto.evaluateGraph = function evaluateGraph(deltaTime) {
6753
+ this.context.update(deltaTime);
6754
+ if (!this.rootNode.isInitialized()) {
6755
+ this.resetGraphState();
6756
+ }
6757
+ // Evaluate the entire animation graph starting from the rootNode
6758
+ if (this.rootNode) {
6759
+ this.result = this.rootNode.evaluate(this.context, this.result);
6760
+ }
6761
+ // Reset trigger nodes
6762
+ for(var i = 0; i < this.getNumControlParameters(); i++){
6763
+ var controlParameterNode = this.nodes[i];
6764
+ if (_instanceof1(controlParameterNode, ControlParameterTriggerNode)) {
6765
+ controlParameterNode.setValue(false);
6766
+ }
6767
+ }
6768
+ return this.result;
6207
6769
  };
6208
- /**
6209
- * 拷贝向量
6210
- * @param v - 复制对象
6211
- * @returns 拷贝结果
6212
- */ _proto.copyFrom = function copyFrom(v) {
6213
- this.x = v.x;
6214
- this.y = v.y;
6215
- this.z = v.z;
6216
- this.w = v.w;
6217
- return this;
6770
+ _proto.isInitialized = function isInitialized() {
6771
+ return this.rootNode && this.rootNode.isInitialized();
6218
6772
  };
6219
- /**
6220
- * 克隆向量
6221
- * @returns 克隆结果
6222
- */ _proto.clone = function clone() {
6223
- return new Vector4(this.x, this.y, this.z, this.w);
6773
+ // General Node Info
6774
+ //-------------------------------------------------------------------------
6775
+ _proto.isNodeActive = function isNodeActive(nodeIdx) {
6776
+ return this.isControlParameter(nodeIdx) || this.nodes[nodeIdx].isNodeActive(this.context.updateID);
6224
6777
  };
6225
- /**
6226
- * 根据下标设置向量分量
6227
- * @param index - 下标值
6228
- * @param value - 分量值
6229
- * @returns 向量
6230
- */ _proto.setElement = function setElement(index, value) {
6231
- switch(index){
6232
- case 0:
6233
- this.x = value;
6234
- break;
6235
- case 1:
6236
- this.y = value;
6237
- break;
6238
- case 2:
6239
- this.z = value;
6240
- break;
6241
- case 3:
6242
- this.w = value;
6243
- break;
6244
- default:
6245
- console.error("index is out of range: " + index);
6778
+ // Graph State
6779
+ //-------------------------------------------------------------------------
6780
+ _proto.resetGraphState = function resetGraphState() {
6781
+ if (this.rootNode.isInitialized()) {
6782
+ this.rootNode.shutdown(this.context);
6246
6783
  }
6247
- return this;
6784
+ this.context.updateID++; // Bump the update ID to ensure that any initialization code that relies on it is dirtied.
6785
+ this.rootNode.initialize(this.context);
6248
6786
  };
6249
- /**
6250
- * 根据下标获取向量分量
6251
- * @param index - 下标
6252
- * @returns 分量值
6253
- */ _proto.getElement = function getElement(index) {
6254
- switch(index){
6255
- case 0:
6256
- return this.x;
6257
- case 1:
6258
- return this.y;
6259
- case 2:
6260
- return this.z;
6261
- case 3:
6262
- return this.w;
6263
- default:
6264
- console.error("index is out of range: " + index);
6265
- }
6266
- return 0;
6787
+ // Control Parameters
6788
+ //-------------------------------------------------------------------------
6789
+ _proto.getNumControlParameters = function getNumControlParameters() {
6790
+ return this.graphAsset.controlParameterIDs.length;
6267
6791
  };
6268
- /**
6269
- * 向量相加
6270
- * @param right - 相加对象,向量 | 数字
6271
- * @returns 相加结果
6272
- */ _proto.add = function add(right) {
6273
- if (typeof right === "number") {
6274
- this.x += right;
6275
- this.y += right;
6276
- this.z += right;
6277
- this.w += right;
6278
- } else if (_instanceof1(right, Array)) {
6279
- this.x += right[0];
6280
- this.y += right[1];
6281
- this.z += right[2];
6282
- this.w += right[3];
6283
- } else {
6284
- this.x += right.x;
6285
- this.y += right.y;
6286
- this.z += right.z;
6287
- this.w += right.w;
6792
+ _proto.getControlParameterIndex = function getControlParameterIndex(parameterID) {
6793
+ var parameterLookupMap = this.graphAsset.parameterLookupMap;
6794
+ var res = parameterLookupMap.get(parameterID);
6795
+ if (res !== undefined) {
6796
+ return res;
6288
6797
  }
6289
- return this;
6290
- };
6291
- /**
6292
- * 向量相加
6293
- * @param left - 向量
6294
- * @param right - 向量
6295
- * @returns 求和结果
6296
- */ _proto.addVectors = function addVectors(left, right) {
6297
- this.x = left.x + right.x;
6298
- this.y = left.y + right.y;
6299
- this.z = left.z + right.z;
6300
- this.w = left.w + right.w;
6301
- return this;
6798
+ console.warn("Parameter '" + parameterID + "' does not exist.");
6799
+ return InvalidIndex;
6302
6800
  };
6303
- /**
6304
- * 向量比例缩放后相加
6305
- * @param right - 向量
6306
- * @param s - 比例
6307
- * @returns 求和结果
6308
- */ _proto.addScaledVector = function addScaledVector(right, s) {
6309
- this.x += right.x * s;
6310
- this.y += right.y * s;
6311
- this.z += right.z * s;
6312
- this.w += right.w * s;
6313
- return this;
6801
+ _proto.getControlParameterID = function getControlParameterID(parameterNodeIndex) {
6802
+ return this.graphAsset.controlParameterIDs[parameterNodeIndex];
6314
6803
  };
6315
- /**
6316
- * 向量相减
6317
- * @param right - 相减对象,向量 | 数字
6318
- * @returns 相减结果
6319
- */ _proto.subtract = function subtract(right) {
6320
- if (typeof right === "number") {
6321
- this.x -= right;
6322
- this.y -= right;
6323
- this.z -= right;
6324
- this.w -= right;
6325
- } else if (_instanceof1(right, Array)) {
6326
- this.x -= right[0];
6327
- this.y -= right[1];
6328
- this.z -= right[2];
6329
- this.w -= right[3];
6330
- } else {
6331
- this.x -= right.x;
6332
- this.y -= right.y;
6333
- this.z -= right.z;
6334
- this.w -= right.w;
6335
- }
6336
- return this;
6804
+ _proto.setBool = function setBool(name, value) {
6805
+ this.setControlParameterValue(name, value);
6337
6806
  };
6338
- /**
6339
- * 向量相减
6340
- * @param left - 向量
6341
- * @param right - 向量
6342
- * @returns 向量
6343
- */ _proto.subtractVectors = function subtractVectors(left, right) {
6344
- this.x = left.x - right.x;
6345
- this.y = left.y - right.y;
6346
- this.z = left.z - right.z;
6347
- this.w = left.w - right.w;
6348
- return this;
6807
+ _proto.setFloat = function setFloat(name, value) {
6808
+ this.setControlParameterValue(name, value);
6349
6809
  };
6350
- /**
6351
- * 向量相乘
6352
- * @param right - 相乘对象,对象 | 数字
6353
- * @returns 向量
6354
- */ _proto.multiply = function multiply(right) {
6355
- if (typeof right === "number") {
6356
- this.x *= right;
6357
- this.y *= right;
6358
- this.z *= right;
6359
- this.w *= right;
6360
- } else if (_instanceof1(right, Array)) {
6361
- this.x *= right[0];
6362
- this.y *= right[1];
6363
- this.z *= right[2];
6364
- this.w *= right[3];
6365
- } else {
6366
- this.x *= right.x;
6367
- this.y *= right.y;
6368
- this.z *= right.z;
6369
- this.w *= right.w;
6370
- }
6371
- return this;
6810
+ _proto.setTrigger = function setTrigger(name) {
6811
+ this.setControlParameterValue(name, true);
6372
6812
  };
6373
- /**
6374
- * 向量相乘
6375
- * @param left - 向量
6376
- * @param right - 向量
6377
- * @returns 向量
6378
- */ _proto.multiplyVectors = function multiplyVectors(left, right) {
6379
- this.x = left.x * right.x;
6380
- this.y = left.y * right.y;
6381
- this.z = left.z * right.z;
6382
- this.w = left.w * right.w;
6383
- return this;
6813
+ _proto.resetTrigger = function resetTrigger(name) {
6814
+ this.setControlParameterValue(name, false);
6384
6815
  };
6385
- /**
6386
- * 向量相除
6387
- * @param right - 相除对象,对象 | 数字
6388
- * @returns 向量
6389
- */ _proto.divide = function divide(right) {
6390
- if (typeof right === "number") {
6391
- this.x /= right;
6392
- this.y /= right;
6393
- this.z /= right;
6394
- this.w /= right;
6395
- } else if (_instanceof1(right, Array)) {
6396
- this.x /= right[0];
6397
- this.y /= right[1];
6398
- this.z /= right[2];
6399
- this.w /= right[3];
6400
- } else {
6401
- this.x /= right.x;
6402
- this.y /= right.y;
6403
- this.z /= right.z;
6404
- this.w /= right.w;
6405
- }
6406
- return this;
6816
+ // Debug Information
6817
+ //-------------------------------------------------------------------------
6818
+ _proto.getPoseNodeDebugInfo = function getPoseNodeDebugInfo(nodeIdx) {
6819
+ var node = this.nodes[nodeIdx];
6820
+ return node.getDebugInfo();
6407
6821
  };
6408
- /**
6409
- * 向量缩放
6410
- * @param v - 数字
6411
- * @returns 缩放结果
6412
- */ _proto.scale = function scale(v) {
6413
- this.x *= v;
6414
- this.y *= v;
6415
- this.z *= v;
6416
- this.w *= v;
6417
- return this;
6822
+ _proto.getRuntimeNodeDebugValue = function getRuntimeNodeDebugValue(nodeIdx) {
6823
+ var valueNode = this.nodes[nodeIdx];
6824
+ return valueNode.getValue(this.context);
6418
6825
  };
6419
- /**
6420
- * 分量求和
6421
- * @returns 求和结果
6422
- */ _proto.sum = function sum() {
6423
- return this.x + this.y + this.z + this.w;
6826
+ _proto.getNodeDebugInstance = function getNodeDebugInstance(nodeIdx) {
6827
+ return this.nodes[nodeIdx];
6424
6828
  };
6425
- /**
6426
- * 向量求最小值
6427
- * @param v - 向量或数值
6428
- * @returns 最小值
6429
- */ _proto.min = function min(v) {
6430
- if (typeof v === "number") {
6431
- this.x = Math.min(this.x, v);
6432
- this.y = Math.min(this.y, v);
6433
- this.z = Math.min(this.z, v);
6434
- this.w = Math.min(this.w, v);
6435
- } else {
6436
- this.x = Math.min(this.x, v.x);
6437
- this.y = Math.min(this.y, v.y);
6438
- this.z = Math.min(this.z, v.z);
6439
- this.w = Math.min(this.w, v.w);
6440
- }
6441
- return this;
6829
+ _proto.isControlParameter = function isControlParameter(nodeIdx) {
6830
+ return nodeIdx < this.getNumControlParameters();
6442
6831
  };
6443
- /**
6444
- * 向量求最大值
6445
- * @param v - 向量或数值
6446
- * @returns 最大值
6447
- */ _proto.max = function max(v) {
6448
- if (typeof v === "number") {
6449
- this.x = Math.max(this.x, v);
6450
- this.y = Math.max(this.y, v);
6451
- this.z = Math.max(this.z, v);
6452
- this.w = Math.max(this.w, v);
6453
- } else {
6454
- this.x = Math.max(this.x, v.x);
6455
- this.y = Math.max(this.y, v.y);
6456
- this.z = Math.max(this.z, v.z);
6457
- this.w = Math.max(this.w, v.w);
6832
+ _proto.setControlParameterValue = function setControlParameterValue(name, value) {
6833
+ var index = this.getControlParameterIndex(name);
6834
+ if (index !== InvalidIndex) {
6835
+ this.nodes[index].setValue(value);
6458
6836
  }
6459
- return this;
6460
6837
  };
6838
+ return GraphInstance;
6839
+ }();
6840
+
6841
+ function _defineProperties(target, props) {
6842
+ for(var i = 0; i < props.length; i++){
6843
+ var descriptor = props[i];
6844
+ descriptor.enumerable = descriptor.enumerable || false;
6845
+ descriptor.configurable = true;
6846
+ if ("value" in descriptor) descriptor.writable = true;
6847
+ Object.defineProperty(target, descriptor.key, descriptor);
6848
+ }
6849
+ }
6850
+ function _create_class(Constructor, protoProps, staticProps) {
6851
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
6852
+ if (staticProps) _defineProperties(Constructor, staticProps);
6853
+ return Constructor;
6854
+ }
6855
+
6856
+ /**
6857
+ * @since 2.0.0
6858
+ */ var Component = /*#__PURE__*/ function(EffectsObject) {
6859
+ _inherits(Component, EffectsObject);
6860
+ function Component() {
6861
+ var _this;
6862
+ _this = EffectsObject.apply(this, arguments) || this;
6863
+ _this.isAwakeCalled = false;
6864
+ _this.isStartCalled = false;
6865
+ _this.isEnableCalled = false;
6866
+ _this._enabled = true;
6867
+ return _this;
6868
+ }
6869
+ var _proto = Component.prototype;
6461
6870
  /**
6462
- * 向量阈值约束
6463
- * @param min - 最小值
6464
- * @param max - 最大值
6465
- * @returns 向量
6466
- */ _proto.clamp = function clamp(min, max) {
6467
- return this.max(min).min(max);
6871
+ * 生命周期函数,初始化后调用,生命周期内只调用一次
6872
+ */ _proto.onAwake = function onAwake() {
6873
+ // OVERRIDE
6468
6874
  };
6469
6875
  /**
6470
- * 向量向下取整
6471
- * @returns 取整结果
6472
- */ _proto.floor = function floor() {
6473
- this.x = Math.floor(this.x);
6474
- this.y = Math.floor(this.y);
6475
- this.z = Math.floor(this.z);
6476
- this.w = Math.floor(this.w);
6477
- return this;
6876
+ * 在 enabled 变为 true 时触发
6877
+ */ _proto.onEnable = function onEnable() {
6878
+ // OVERRIDE
6478
6879
  };
6479
6880
  /**
6480
- * 向量向上取整
6481
- * @returns 取整结果
6482
- */ _proto.ceil = function ceil() {
6483
- this.x = Math.ceil(this.x);
6484
- this.y = Math.ceil(this.y);
6485
- this.z = Math.ceil(this.z);
6486
- this.w = Math.ceil(this.w);
6487
- return this;
6881
+ * 在 enabled 变为 false 时触发
6882
+ */ _proto.onDisable = function onDisable() {
6883
+ // OVERRIDE
6488
6884
  };
6489
6885
  /**
6490
- * 向量四舍五入
6491
- * @returns 求值结果
6492
- */ _proto.round = function round() {
6493
- this.x = Math.round(this.x);
6494
- this.y = Math.round(this.y);
6495
- this.z = Math.round(this.z);
6496
- this.w = Math.round(this.w);
6497
- return this;
6886
+ * 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
6887
+ */ _proto.onStart = function onStart() {
6888
+ // OVERRIDE
6498
6889
  };
6499
6890
  /**
6500
- * 向量取绝对值
6501
- * @returns 向量
6502
- */ _proto.abs = function abs() {
6503
- this.x = Math.abs(this.x);
6504
- this.y = Math.abs(this.y);
6505
- this.z = Math.abs(this.z);
6506
- this.w = Math.abs(this.w);
6507
- return this;
6891
+ * 生命周期函数,每帧调用一次
6892
+ */ _proto.onUpdate = function onUpdate(dt) {
6893
+ // OVERRIDE
6508
6894
  };
6509
6895
  /**
6510
- * 向量取反
6511
- * @returns 取反结果
6512
- */ _proto.negate = function negate() {
6513
- this.x = -this.x;
6514
- this.y = -this.y;
6515
- this.z = -this.z;
6516
- this.w = -this.w;
6517
- return this;
6896
+ * 生命周期函数,每帧调用一次,在 update 之后调用
6897
+ */ _proto.onLateUpdate = function onLateUpdate(dt) {
6898
+ // OVERRIDE
6518
6899
  };
6519
6900
  /**
6520
- * 向量长度平方
6521
- * @returns 长度平方
6522
- */ _proto.lengthSquared = function lengthSquared() {
6523
- return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
6901
+ * 生命周期函数,在组件销毁时调用
6902
+ */ _proto.onDestroy = function onDestroy() {
6903
+ // OVERRIDE
6524
6904
  };
6525
6905
  /**
6526
- * 向量长度
6527
- * @returns 长度
6528
- */ _proto.length = function length() {
6529
- return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
6906
+ * @internal
6907
+ */ _proto.enable = function enable() {
6908
+ if (this.item.composition) {
6909
+ this.item.composition.sceneTicking.addComponent(this);
6910
+ this.isEnableCalled = true;
6911
+ }
6912
+ this.onEnable();
6530
6913
  };
6531
6914
  /**
6532
- * 向量归一化
6533
- * @returns 归一化结果
6534
- */ _proto.normalize = function normalize() {
6535
- return this.divide(this.length() || 1);
6915
+ * @internal
6916
+ */ _proto.disable = function disable() {
6917
+ this.onDisable();
6918
+ if (this.item.composition) {
6919
+ this.isEnableCalled = false;
6920
+ this.item.composition.sceneTicking.removeComponent(this);
6921
+ }
6536
6922
  };
6537
- /**
6538
- * 设置向量长度
6539
- * @param length - 长度
6540
- * @returns 向量
6541
- */ _proto.setLength = function setLength(length) {
6542
- return this.normalize().multiply(length);
6923
+ _proto.setVFXItem = function setVFXItem(item) {
6924
+ this.item = item;
6925
+ if (item.isDuringPlay) {
6926
+ if (!this.isAwakeCalled) {
6927
+ this.onAwake();
6928
+ this.isAwakeCalled = true;
6929
+ }
6930
+ if (item.isActive && this.enabled) {
6931
+ this.start();
6932
+ this.enable();
6933
+ }
6934
+ }
6543
6935
  };
6544
- /**
6545
- * 向量求线性插值
6546
- * @param v - 向量
6547
- * @param alpha - 插值比例
6548
- * @returns 插值结果
6549
- */ _proto.lerp = function lerp(v, alpha) {
6550
- this.x += (v.x - this.x) * alpha;
6551
- this.y += (v.y - this.y) * alpha;
6552
- this.z += (v.z - this.z) * alpha;
6553
- this.w += (v.w - this.w) * alpha;
6554
- return this;
6936
+ _proto.fromData = function fromData(data) {
6937
+ EffectsObject.prototype.fromData.call(this, data);
6555
6938
  };
6556
- /**
6557
- * 两向量求线性插值
6558
- * @param v1 - 第一个向量
6559
- * @param v2 - 第二个向量
6560
- * @param alpha - 插值比例
6561
- * @returns 插值结果
6562
- */ _proto.lerpVectors = function lerpVectors(v1, v2, alpha) {
6563
- this.x = v1.x + (v2.x - v1.x) * alpha;
6564
- this.y = v1.y + (v2.y - v1.y) * alpha;
6565
- this.z = v1.z + (v2.z - v1.z) * alpha;
6566
- this.w = v1.w + (v2.w - v1.w) * alpha;
6567
- return this;
6939
+ _proto.dispose = function dispose() {
6940
+ if (this.isEnableCalled) {
6941
+ this.disable();
6942
+ }
6943
+ if (this.isAwakeCalled) {
6944
+ this.isAwakeCalled = false;
6945
+ this.onDestroy();
6946
+ }
6947
+ if (this.item) {
6948
+ removeItem(this.item.components, this);
6949
+ }
6568
6950
  };
6569
- /**
6570
- * 向量求点积
6571
- * @param v - 向量
6572
- * @returns 点积结果
6573
- */ _proto.dot = function dot(v) {
6574
- return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;
6951
+ _proto.start = function start() {
6952
+ if (this.isStartCalled) {
6953
+ return;
6954
+ }
6955
+ this.isStartCalled = true;
6956
+ this.onStart();
6575
6957
  };
6576
- /**
6577
- * 向量判等
6578
- * @param v - 向量
6579
- * @returns 判等结果
6580
- */ _proto.equals = function equals(v) {
6581
- return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w;
6958
+ _create_class(Component, [
6959
+ {
6960
+ key: "transform",
6961
+ get: /**
6962
+ * 附加到的 VFXItem 对象 Transform 组件
6963
+ */ function get() {
6964
+ return this.item.transform;
6965
+ }
6966
+ },
6967
+ {
6968
+ key: "isActiveAndEnabled",
6969
+ get: /**
6970
+ * 组件是否可以更新,true 更新,false 不更新
6971
+ */ function get() {
6972
+ return this.item.isActive && this.enabled;
6973
+ }
6974
+ },
6975
+ {
6976
+ key: "enabled",
6977
+ get: function get() {
6978
+ return this._enabled;
6979
+ },
6980
+ set: function set(value) {
6981
+ if (this.enabled !== value) {
6982
+ this._enabled = value;
6983
+ if (value) {
6984
+ if (this.isActiveAndEnabled) {
6985
+ this.enable();
6986
+ if (!this.isStartCalled) {
6987
+ this.onStart();
6988
+ this.isStartCalled = true;
6989
+ }
6990
+ }
6991
+ } else {
6992
+ if (this.isEnableCalled) {
6993
+ this.disable();
6994
+ }
6995
+ }
6996
+ }
6997
+ }
6998
+ }
6999
+ ]);
7000
+ return Component;
7001
+ }(EffectsObject);
7002
+ __decorate([
7003
+ serialize()
7004
+ ], Component.prototype, "item", void 0);
7005
+ __decorate([
7006
+ serialize()
7007
+ ], Component.prototype, "_enabled", void 0);
7008
+ /**
7009
+ * @since 2.0.0
7010
+ * @deprecated 2.4.0 Please use Component instead
7011
+ */ var Behaviour = /*#__PURE__*/ function(Component) {
7012
+ _inherits(Behaviour, Component);
7013
+ function Behaviour() {
7014
+ return Component.apply(this, arguments);
7015
+ }
7016
+ var _proto = Behaviour.prototype;
7017
+ _proto.setVFXItem = function setVFXItem(item) {
7018
+ Component.prototype.setVFXItem.call(this, item);
6582
7019
  };
6583
- /**
6584
- * 是否零向量
6585
- * @returns 是否零向量
6586
- */ _proto.isZero = function isZero() {
6587
- var eps = NumberEpsilon;
6588
- var _this = this, x = _this.x, y = _this.y, z = _this.z, w = _this.w;
6589
- return Math.abs(x) <= eps && Math.abs(y) <= eps && Math.abs(z) <= eps && Math.abs(w) <= eps;
7020
+ _proto.dispose = function dispose() {
7021
+ Component.prototype.dispose.call(this);
6590
7022
  };
6591
- /**
6592
- * 向量转数组
6593
- * @returns 数组
6594
- */ _proto.toArray = function toArray() {
6595
- return [
6596
- this.x,
6597
- this.y,
6598
- this.z,
6599
- this.w
6600
- ];
7023
+ return Behaviour;
7024
+ }(Component);
7025
+
7026
+ var Animator = /*#__PURE__*/ function(Component) {
7027
+ _inherits(Animator, Component);
7028
+ function Animator() {
7029
+ var _this;
7030
+ _this = Component.apply(this, arguments) || this;
7031
+ /**
7032
+ * @internal
7033
+ */ _this.graph = null;
7034
+ _this.graphAsset = null;
7035
+ return _this;
7036
+ }
7037
+ var _proto = Animator.prototype;
7038
+ _proto.setBool = function setBool(name, value) {
7039
+ if (this.graph) {
7040
+ this.graph.setBool(name, value);
7041
+ }
6601
7042
  };
6602
- _proto.toVector3 = function toVector3() {
6603
- return new Vector3(this.x, this.y, this.z);
7043
+ _proto.setFloat = function setFloat(name, value) {
7044
+ if (this.graph) {
7045
+ this.graph.setFloat(name, value);
7046
+ }
6604
7047
  };
6605
- _proto.fill = function fill(array, offset) {
6606
- if (offset === void 0) offset = 0;
6607
- array[offset] = this.x;
6608
- array[offset + 1] = this.y;
6609
- array[offset + 2] = this.z;
6610
- array[offset + 3] = this.w;
7048
+ _proto.setTrigger = function setTrigger(name) {
7049
+ if (this.graph) {
7050
+ this.graph.setTrigger(name);
7051
+ }
6611
7052
  };
6612
- /**
6613
- * 生成随机向量
6614
- * @returns 向量
6615
- */ _proto.random = function random() {
6616
- this.x = Math.random();
6617
- this.y = Math.random();
6618
- this.z = Math.random();
6619
- this.w = Math.random();
6620
- return this;
7053
+ _proto.resetTrigger = function resetTrigger(name) {
7054
+ if (this.graph) {
7055
+ this.graph.resetTrigger(name);
7056
+ }
6621
7057
  };
6622
- /**
6623
- * 变换矩阵作用于向量
6624
- * @param m - 变换矩阵
6625
- * @param [out] - 输出结果,如果没有设置就直接覆盖当前值
6626
- * @returns 向量
6627
- */ _proto.applyMatrix = function applyMatrix(m, out) {
6628
- return m.transformVector4(this, out);
7058
+ _proto.onStart = function onStart() {
7059
+ if (this.graphAsset) {
7060
+ this.graph = new GraphInstance(this.graphAsset, this.item);
7061
+ }
6629
7062
  };
6630
- /**
6631
- * 通过标量数值创建向量
6632
- * @param num - 数值
6633
- * @returns 向量
6634
- */ Vector4.fromNumber = function fromNumber(num) {
6635
- return new Vector4().setFromNumber(num);
7063
+ _proto.onUpdate = function onUpdate(dt) {
7064
+ if (!this.graph) {
7065
+ return;
7066
+ }
7067
+ var result = this.graph.evaluateGraph(dt / 1000);
7068
+ // Apply transform animation
7069
+ //-------------------------------------------------------------------------
7070
+ var animatedTransforms = this.graph.skeleton.animatedTransforms;
7071
+ for(var i = 0; i < animatedTransforms.length; i++){
7072
+ var position = result.pose.parentSpaceTransforms[i].position;
7073
+ var rotation = result.pose.parentSpaceTransforms[i].rotation;
7074
+ var scale = result.pose.parentSpaceTransforms[i].scale;
7075
+ var euler = result.pose.parentSpaceTransforms[i].euler;
7076
+ animatedTransforms[i].setPosition(position.x, position.y, position.z);
7077
+ animatedTransforms[i].setScale(scale.x, scale.y, scale.z);
7078
+ if (this.graph.skeleton.useEuler) {
7079
+ animatedTransforms[i].setRotation(euler.x, euler.y, euler.z);
7080
+ } else {
7081
+ animatedTransforms[i].setQuaternion(rotation.x, rotation.y, rotation.z, rotation.w);
7082
+ }
7083
+ }
7084
+ // Apply property animation
7085
+ //-------------------------------------------------------------------------
7086
+ var floatAnimatedObjects = this.graph.skeleton.floatAnimatedObjects;
7087
+ for(var i1 = 0; i1 < floatAnimatedObjects.length; i1++){
7088
+ var animatedObject = floatAnimatedObjects[i1];
7089
+ var property = animatedObject.property;
7090
+ animatedObject.target[property] = result.pose.floatPropertyValues[i1];
7091
+ }
7092
+ var colorAnimatedObjects = this.graph.skeleton.colorAnimatedObjects;
7093
+ for(var i2 = 0; i2 < colorAnimatedObjects.length; i2++){
7094
+ var animatedObject1 = colorAnimatedObjects[i2];
7095
+ var property1 = animatedObject1.property;
7096
+ animatedObject1.target[property1] = result.pose.colorPropertyValues[i2];
7097
+ }
6636
7098
  };
6637
- /**
6638
- * 通过数组创建向量
6639
- * @param array - 数组
6640
- * @param [offset=0] - 起始偏移值
6641
- * @returns 向量
6642
- */ Vector4.fromArray = function fromArray(array, offset) {
6643
- if (offset === void 0) offset = 0;
6644
- return new Vector4().setFromArray(array, offset);
7099
+ _proto.fromData = function fromData(data) {
7100
+ this.graphAsset = this.engine.findObject(data.graphAsset);
6645
7101
  };
6646
- return Vector4;
6647
- }();
7102
+ return Animator;
7103
+ }(Component);
7104
+ Animator = __decorate([
7105
+ effectsClass("Animator")
7106
+ ], Animator);
7107
+
6648
7108
  /**
6649
- * 四维向量的常量
6650
- */ Vector4.ONE = new Vector4(1.0, 1.0, 1.0, 1.0);
6651
- Vector4.ZERO = new Vector4(0.0, 0.0, 0.0, 0.0);
7109
+ * 所有渲染组件的基类
7110
+ * @since 2.0.0
7111
+ */ var RendererComponent = /*#__PURE__*/ function(Component) {
7112
+ _inherits(RendererComponent, Component);
7113
+ function RendererComponent() {
7114
+ var _this;
7115
+ _this = Component.apply(this, arguments) || this;
7116
+ _this.materials = [];
7117
+ _this._priority = 0;
7118
+ return _this;
7119
+ }
7120
+ var _proto = RendererComponent.prototype;
7121
+ _proto.render = function render(renderer) {};
7122
+ _proto.onEnable = function onEnable() {
7123
+ var _this_item_composition;
7124
+ (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.addMeshToDefaultRenderPass(this);
7125
+ };
7126
+ _proto.onDisable = function onDisable() {
7127
+ var _this_item_composition;
7128
+ (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.removeMeshFromDefaultRenderPass(this);
7129
+ };
7130
+ _create_class(RendererComponent, [
7131
+ {
7132
+ key: "priority",
7133
+ get: function get() {
7134
+ return this._priority;
7135
+ },
7136
+ set: function set(value) {
7137
+ this._priority = value;
7138
+ }
7139
+ },
7140
+ {
7141
+ key: "material",
7142
+ get: function get() {
7143
+ return this.materials[0];
7144
+ },
7145
+ set: function set(material) {
7146
+ if (this.materials.length === 0) {
7147
+ this.materials.push(material);
7148
+ } else {
7149
+ this.materials[0] = material;
7150
+ }
7151
+ }
7152
+ }
7153
+ ]);
7154
+ return RendererComponent;
7155
+ }(Component);
7156
+ __decorate([
7157
+ serialize()
7158
+ ], RendererComponent.prototype, "materials", void 0);
7159
+ __decorate([
7160
+ serialize()
7161
+ ], RendererComponent.prototype, "_priority", void 0);
6652
7162
 
6653
7163
  /**
6654
7164
  * Mesh 组件
@@ -6777,516 +7287,6 @@ PostProcessVolume = __decorate([
6777
7287
  effectsClass(DataType.PostProcessVolume)
6778
7288
  ], PostProcessVolume);
6779
7289
 
6780
- var Color = /*#__PURE__*/ function() {
6781
- function Color(r, g, b, a) {
6782
- if (r === void 0) r = 0;
6783
- if (g === void 0) g = 0;
6784
- if (b === void 0) b = 0;
6785
- if (a === void 0) a = 0;
6786
- this.r = r;
6787
- this.g = g;
6788
- this.b = b;
6789
- this.a = a;
6790
- }
6791
- var _proto = Color.prototype;
6792
- /**
6793
- * 设置颜色
6794
- * @param r - r 分量
6795
- * @param g - g 分量
6796
- * @param b - b 分量
6797
- * @param a - a 分量
6798
- * @returns
6799
- */ _proto.set = function set(r, g, b, a) {
6800
- this.r = r;
6801
- this.g = g;
6802
- this.b = b;
6803
- this.a = a;
6804
- return this;
6805
- };
6806
- /**
6807
- * 设置零颜色
6808
- * @returns
6809
- */ _proto.setZero = function setZero() {
6810
- this.r = 0;
6811
- this.g = 0;
6812
- this.b = 0;
6813
- this.a = 0;
6814
- return this;
6815
- };
6816
- /**
6817
- * 通过标量数值设置颜色
6818
- * @param num - 数值
6819
- * @returns
6820
- */ _proto.setFromNumber = function setFromNumber(num) {
6821
- this.r = num;
6822
- this.g = num;
6823
- this.b = num;
6824
- this.a = num;
6825
- return this;
6826
- };
6827
- /**
6828
- * 通过Vector4创建颜色
6829
- * @param v - Vector4
6830
- * @returns
6831
- */ _proto.setFromVector4 = function setFromVector4(v) {
6832
- this.r = v.x;
6833
- this.g = v.y;
6834
- this.b = v.z;
6835
- this.a = v.w;
6836
- return this;
6837
- };
6838
- /**
6839
- * 通过数组创建颜色
6840
- * @param array - 数组
6841
- * @param [offset=0] - 起始偏移值
6842
- * @returns
6843
- */ _proto.setFromArray = function setFromArray(array, offset) {
6844
- if (offset === void 0) offset = 0;
6845
- var _array_offset;
6846
- this.r = (_array_offset = array[offset]) != null ? _array_offset : 0;
6847
- var _array_;
6848
- this.g = (_array_ = array[offset + 1]) != null ? _array_ : 0;
6849
- var _array_1;
6850
- this.b = (_array_1 = array[offset + 2]) != null ? _array_1 : 0;
6851
- var _array_2;
6852
- this.a = (_array_2 = array[offset + 3]) != null ? _array_2 : 0;
6853
- return this;
6854
- };
6855
- _proto.setFromHSV = function setFromHSV(hue, saturation, value, alpha) {
6856
- if (alpha === void 0) alpha = 1;
6857
- var chroma = value * saturation;
6858
- var h = hue / 60;
6859
- var x = chroma * (1 - Math.abs(h % 2 - 1));
6860
- var r = 0;
6861
- var g = 0;
6862
- var b = 0;
6863
- if (h >= 0 && h <= 1) {
6864
- r = chroma;
6865
- g = x;
6866
- } else if (h >= 1 && h <= 2) {
6867
- r = x;
6868
- g = chroma;
6869
- } else if (h >= 2 && h <= 3) {
6870
- g = chroma;
6871
- b = x;
6872
- } else if (h >= 3 && h <= 4) {
6873
- g = x;
6874
- b = chroma;
6875
- } else if (h >= 4 && h <= 5) {
6876
- r = x;
6877
- b = chroma;
6878
- } else if (h >= 5 && h <= 6) {
6879
- r = chroma;
6880
- b = x;
6881
- }
6882
- var m = value - chroma;
6883
- return this.set(r + m, g + m, b + m, alpha);
6884
- };
6885
- _proto.setFromHexString = function setFromHexString(hex) {
6886
- if (hex.substring(0, 1) !== "#" || hex.length !== 9 && hex.length !== 7) {
6887
- return this;
6888
- }
6889
- var r = parseInt(hex.substring(1, 3), 16) / 255.0;
6890
- var g = parseInt(hex.substring(3, 5), 16) / 255.0;
6891
- var b = parseInt(hex.substring(5, 7), 16) / 255.0;
6892
- var a = hex.length === 9 ? parseInt(hex.substring(7, 9), 16) / 255.0 : 1.0;
6893
- return this.set(r, g, b, a);
6894
- };
6895
- /**
6896
- * 拷贝颜色
6897
- * @param v - 复制对象
6898
- * @returns 拷贝结果
6899
- */ _proto.copyFrom = function copyFrom(v) {
6900
- this.r = v.r;
6901
- this.g = v.g;
6902
- this.b = v.b;
6903
- this.a = v.a;
6904
- return this;
6905
- };
6906
- /**
6907
- * 克隆颜色
6908
- * @returns 克隆结果
6909
- */ _proto.clone = function clone() {
6910
- return new Color(this.r, this.g, this.b, this.a);
6911
- };
6912
- /**
6913
- * 根据下标设置颜色分量
6914
- * @param index - 下标值
6915
- * @param value - 分量值
6916
- * @returns
6917
- */ _proto.setElement = function setElement(index, value) {
6918
- switch(index){
6919
- case 0:
6920
- this.r = value;
6921
- break;
6922
- case 1:
6923
- this.g = value;
6924
- break;
6925
- case 2:
6926
- this.b = value;
6927
- break;
6928
- case 3:
6929
- this.a = value;
6930
- break;
6931
- default:
6932
- console.error("index is out of range: " + index);
6933
- }
6934
- return this;
6935
- };
6936
- /**
6937
- * 根据下标获取颜色分量
6938
- * @param index - 下标
6939
- * @returns 分量值
6940
- */ _proto.getElement = function getElement(index) {
6941
- switch(index){
6942
- case 0:
6943
- return this.r;
6944
- case 1:
6945
- return this.g;
6946
- case 2:
6947
- return this.b;
6948
- case 3:
6949
- return this.a;
6950
- default:
6951
- console.error("index is out of range: " + index);
6952
- }
6953
- return 0;
6954
- };
6955
- /**
6956
- * 颜色相加
6957
- * @param right - 相加对象,颜色 | 数字
6958
- * @returns 相加结果
6959
- */ _proto.add = function add(right) {
6960
- if (typeof right === "number") {
6961
- this.r += right;
6962
- this.g += right;
6963
- this.b += right;
6964
- this.a += right;
6965
- } else if (_instanceof1(right, Array)) {
6966
- this.r += right[0];
6967
- this.g += right[1];
6968
- this.b += right[2];
6969
- this.a += right[3];
6970
- } else {
6971
- this.r += right.r;
6972
- this.g += right.g;
6973
- this.b += right.b;
6974
- this.a += right.a;
6975
- }
6976
- return this;
6977
- };
6978
- /**
6979
- * 颜色相减
6980
- * @param right - 相减对象,颜色 | 数字
6981
- * @returns 相减结果
6982
- */ _proto.subtract = function subtract(right) {
6983
- if (typeof right === "number") {
6984
- this.r -= right;
6985
- this.g -= right;
6986
- this.b -= right;
6987
- this.a -= right;
6988
- } else if (_instanceof1(right, Array)) {
6989
- this.r -= right[0];
6990
- this.g -= right[1];
6991
- this.b -= right[2];
6992
- this.a -= right[3];
6993
- } else {
6994
- this.r -= right.r;
6995
- this.g -= right.g;
6996
- this.b -= right.b;
6997
- this.a -= right.a;
6998
- }
6999
- return this;
7000
- };
7001
- /**
7002
- * 颜色相乘
7003
- * @param right - 相乘对象,对象 | 数字
7004
- * @returns 颜色
7005
- */ _proto.multiply = function multiply(right) {
7006
- if (typeof right === "number") {
7007
- this.r *= right;
7008
- this.g *= right;
7009
- this.b *= right;
7010
- this.a *= right;
7011
- } else if (_instanceof1(right, Array)) {
7012
- this.r *= right[0];
7013
- this.g *= right[1];
7014
- this.b *= right[2];
7015
- this.a *= right[3];
7016
- } else {
7017
- this.r *= right.r;
7018
- this.g *= right.g;
7019
- this.b *= right.b;
7020
- this.a *= right.a;
7021
- }
7022
- return this;
7023
- };
7024
- /**
7025
- * 颜色相除
7026
- * @param right - 相除对象,对象 | 数字
7027
- * @returns 颜色
7028
- */ _proto.divide = function divide(right) {
7029
- if (typeof right === "number") {
7030
- this.r /= right;
7031
- this.g /= right;
7032
- this.b /= right;
7033
- this.a /= right;
7034
- } else if (_instanceof1(right, Array)) {
7035
- this.r /= right[0];
7036
- this.g /= right[1];
7037
- this.b /= right[2];
7038
- this.a /= right[3];
7039
- } else {
7040
- this.r /= right.r;
7041
- this.g /= right.g;
7042
- this.b /= right.b;
7043
- this.a /= right.a;
7044
- }
7045
- return this;
7046
- };
7047
- /**
7048
- * 颜色缩放
7049
- * @param v - 数字
7050
- * @returns 缩放结果
7051
- */ _proto.scale = function scale(v) {
7052
- this.r *= v;
7053
- this.g *= v;
7054
- this.b *= v;
7055
- this.a *= v;
7056
- return this;
7057
- };
7058
- /**
7059
- * 颜色求最小值
7060
- * @param v - 颜色或数值
7061
- * @returns 最小值
7062
- */ _proto.min = function min(v) {
7063
- if (typeof v === "number") {
7064
- this.r = Math.min(this.r, v);
7065
- this.g = Math.min(this.g, v);
7066
- this.b = Math.min(this.b, v);
7067
- this.a = Math.min(this.a, v);
7068
- } else {
7069
- this.r = Math.min(this.r, v.r);
7070
- this.g = Math.min(this.g, v.g);
7071
- this.b = Math.min(this.b, v.b);
7072
- this.a = Math.min(this.a, v.a);
7073
- }
7074
- return this;
7075
- };
7076
- /**
7077
- * 颜色求最大值
7078
- * @param v - 颜色或数值
7079
- * @returns 最大值
7080
- */ _proto.max = function max(v) {
7081
- if (typeof v === "number") {
7082
- this.r = Math.max(this.r, v);
7083
- this.g = Math.max(this.g, v);
7084
- this.b = Math.max(this.b, v);
7085
- this.a = Math.max(this.a, v);
7086
- } else {
7087
- this.r = Math.max(this.r, v.r);
7088
- this.g = Math.max(this.g, v.g);
7089
- this.b = Math.max(this.b, v.b);
7090
- this.a = Math.max(this.a, v.a);
7091
- }
7092
- return this;
7093
- };
7094
- /**
7095
- * 颜色阈值约束
7096
- * @param min - 最小值
7097
- * @param max - 最大值
7098
- * @returns 颜色
7099
- */ _proto.clamp = function clamp(min, max) {
7100
- return this.max(min).min(max);
7101
- };
7102
- /**
7103
- * 颜色求线性插值
7104
- * @param v - 颜色
7105
- * @param alpha - 插值比例
7106
- * @returns 插值结果
7107
- */ _proto.lerp = function lerp(v, alpha) {
7108
- this.r += (v.r - this.r) * alpha;
7109
- this.g += (v.g - this.g) * alpha;
7110
- this.b += (v.b - this.b) * alpha;
7111
- this.a += (v.a - this.a) * alpha;
7112
- return this;
7113
- };
7114
- /**
7115
- * 计算颜色亮度值
7116
- * @returns 亮度值
7117
- */ _proto.luminance = function luminance() {
7118
- return this.r * 0.3 + this.g * 0.59 + this.b * 0.11;
7119
- };
7120
- /**
7121
- * 颜色判等
7122
- * @param v - 颜色
7123
- * @returns 判等结果
7124
- */ _proto.equals = function equals(v) {
7125
- return v.r === this.r && v.g === this.g && v.b === this.b && v.a === this.a;
7126
- };
7127
- _proto.toLinear = function toLinear() {
7128
- this.r = Color.gammaToLinear(this.r);
7129
- this.g = Color.gammaToLinear(this.g);
7130
- this.b = Color.gammaToLinear(this.b);
7131
- return this;
7132
- };
7133
- _proto.toGamma = function toGamma() {
7134
- this.r = Color.linearToGamma(this.r);
7135
- this.g = Color.linearToGamma(this.g);
7136
- this.b = Color.linearToGamma(this.b);
7137
- return this;
7138
- };
7139
- /**
7140
- * 颜色转数组
7141
- * @returns 数组
7142
- */ _proto.toArray = function toArray() {
7143
- return [
7144
- this.r,
7145
- this.g,
7146
- this.b,
7147
- this.a
7148
- ];
7149
- };
7150
- _proto.toVector4 = function toVector4() {
7151
- return new Vector4(this.r, this.g, this.b, this.a);
7152
- };
7153
- /**
7154
- * RGB 颜色空间转 HSV
7155
- * @param result HSV 值
7156
- */ _proto.toHSV = function toHSV() {
7157
- var _this = this, r = _this.r, g = _this.g, b = _this.b, a = _this.a;
7158
- var max = Math.max(r, g, b);
7159
- var min = Math.min(r, g, b);
7160
- var v = max;
7161
- var dm = max - min;
7162
- var h = 0;
7163
- var s = 0;
7164
- if (max !== 0) {
7165
- s = dm / max;
7166
- }
7167
- if (max != min) {
7168
- if (max == r) {
7169
- h = (g - b) / dm;
7170
- if (g < b) {
7171
- h += 6;
7172
- }
7173
- } else if (max == g) {
7174
- h = (b - r) / dm + 2;
7175
- } else if (max == b) {
7176
- h = (r - g) / dm + 4;
7177
- }
7178
- h *= 60;
7179
- }
7180
- return new Color(h, s, v, a);
7181
- };
7182
- _proto.toHexString = function toHexString(includeAlpha) {
7183
- if (includeAlpha === void 0) includeAlpha = true;
7184
- var R = Color.ToHex(Math.round(this.r * 255));
7185
- var G = Color.ToHex(Math.round(this.g * 255));
7186
- var B = Color.ToHex(Math.round(this.b * 255));
7187
- var A = Color.ToHex(Math.round(this.a * 255));
7188
- if (includeAlpha) {
7189
- return "#" + R + G + B + A;
7190
- } else {
7191
- return "#" + R + G + B;
7192
- }
7193
- };
7194
- _proto.fill = function fill(array, offset) {
7195
- if (offset === void 0) offset = 0;
7196
- array[offset] = this.r;
7197
- array[offset + 1] = this.g;
7198
- array[offset + 2] = this.b;
7199
- array[offset + 3] = this.a;
7200
- };
7201
- /**
7202
- * 通过标量数值创建颜色
7203
- * @param num - 数值
7204
- * @returns
7205
- */ Color.fromNumber = function fromNumber(num) {
7206
- return new Color().setFromNumber(num);
7207
- };
7208
- /**
7209
- * 通过数组创建颜色
7210
- * @param array - 数组
7211
- * @param [offset=0] - 起始偏移值
7212
- * @returns
7213
- */ Color.fromArray = function fromArray(array, offset) {
7214
- if (offset === void 0) offset = 0;
7215
- return new Color().setFromArray(array, offset);
7216
- };
7217
- /**
7218
- * 通过 hex 字符串创建颜色
7219
- * @param hex - hex 字符串
7220
- * @returns
7221
- */ Color.fromHexString = function fromHexString(hex) {
7222
- return new Color().setFromHexString(hex);
7223
- };
7224
- Color.fromHSV = function fromHSV(hue, saturation, value, alpha) {
7225
- if (alpha === void 0) alpha = 1;
7226
- return new Color().setFromHSV(hue, saturation, value, alpha);
7227
- };
7228
- /**
7229
- * 颜色值从 Gamma 空间转到线性空间
7230
- * @param v - Gamma 空间颜色值
7231
- * @returns 线性空间颜色值
7232
- */ Color.gammaToLinear = function gammaToLinear(v) {
7233
- if (v <= 0.0) {
7234
- return 0.0;
7235
- } else if (v <= 0.04045) {
7236
- return v / 12.92;
7237
- } else if (v < 1.0) {
7238
- return Math.pow((v + 0.055) / 1.055, 2.4);
7239
- } else {
7240
- return Math.pow(v, 2.4);
7241
- }
7242
- };
7243
- /**
7244
- * 颜色值从线性空间转到 Gamma 空间
7245
- * @param value - 线性空间颜色值
7246
- * @returns Gamma 空间颜色值
7247
- */ Color.linearToGamma = function linearToGamma(value) {
7248
- if (value <= 0.0) {
7249
- return 0.0;
7250
- } else if (value < 0.0031308) {
7251
- return 12.92 * value;
7252
- } else if (value < 1.0) {
7253
- return 1.055 * Math.pow(value, 0.41666) - 0.055;
7254
- } else {
7255
- return Math.pow(value, 0.41666);
7256
- }
7257
- };
7258
- Color.ToHex = function ToHex(i) {
7259
- var str = i.toString(16);
7260
- if (i <= 15) {
7261
- return ("0" + str).toUpperCase();
7262
- }
7263
- return str.toUpperCase();
7264
- };
7265
- return Color;
7266
- }();
7267
- /**
7268
- * 颜色的常量
7269
- */ Color.BLACK = new Color(0, 0, 0, 1) // 纯黑色
7270
- ;
7271
- Color.BLUE = new Color(0, 0, 1, 1) // 纯蓝色
7272
- ;
7273
- Color.CLEAR = new Color(0, 0, 0, 0) // 完全透明
7274
- ;
7275
- Color.CYAN = new Color(0, 1, 1, 1) // 青色
7276
- ;
7277
- Color.GRAY = new Color(0.5, 0.5, 0.5, 1) // 灰色
7278
- ;
7279
- Color.GREEN = new Color(0, 1, 0, 1) // 纯绿色
7280
- ;
7281
- Color.MAGENTA = new Color(1, 0, 1, 1) // 洋红色
7282
- ;
7283
- Color.RED = new Color(1, 0, 0, 1) // 纯红色
7284
- ;
7285
- Color.WHITE = new Color(1, 1, 1, 1) // 纯白色
7286
- ;
7287
- Color.YELLOW = new Color(1, 0.92, 0.016, 1) // 黄色
7288
- ;
7289
-
7290
7290
  /**
7291
7291
  * 四阶矩阵(列优先矩阵)
7292
7292
  */ var Matrix4 = /*#__PURE__*/ function() {
@@ -24297,7 +24297,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
24297
24297
  return (_this_renderer = this.renderer) == null ? void 0 : _this_renderer.engine;
24298
24298
  };
24299
24299
  /**
24300
- * Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]区间的值,原点在左上角
24300
+ * Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]区间的值,x 向右,y 向上
24301
24301
  * @param x - 鼠标或触点的 x,已经归一化到[-1, 1]
24302
24302
  * @param y - 鼠标或触点的 y,已经归一化到[-1, 1]
24303
24303
  * @param force - 是否强制求交,没有交互信息的 Item 也要进行求交测试
@@ -31143,7 +31143,7 @@ function getStandardSpriteContent(sprite, transform) {
31143
31143
  return ret;
31144
31144
  }
31145
31145
 
31146
- var version$1 = "2.6.7";
31146
+ var version$1 = "2.6.8";
31147
31147
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
31148
31148
  var standardVersion = /^(\d+)\.(\d+)$/;
31149
31149
  var reverseParticle = false;
@@ -34397,7 +34397,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
34397
34397
  registerPlugin("particle", ParticleLoader, VFXItem);
34398
34398
  registerPlugin("cal", CalculateLoader, VFXItem);
34399
34399
  registerPlugin("interact", InteractLoader, VFXItem);
34400
- var version = "2.6.7";
34400
+ var version = "2.6.8";
34401
34401
  logger.info("Core version: " + version + ".");
34402
34402
 
34403
34403
  export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, DEFAULT_FONTS, DEFAULT_FPS, Database, Deferred, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphInstance, GraphNode, GraphNodeData, GraphicsPath, GreaterNodeData, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, KTXTexture, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, NodeTransform, NotNode, NotNodeData, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PluginSystem, PolyStar, Polygon, Pose, PoseNode, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapePath, SourceType, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TangentMode, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, WeightedMode, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getClass, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrame_frag as itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };