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