@predy-js/render-interface 0.3.3-beta.45 → 0.3.3-beta.47

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.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Name: @predy-js/render-interface
3
3
  * Description: undefined
4
4
  * Author: undefined
5
- * Version: v0.3.3-beta.45
5
+ * Version: v0.3.3-beta.47
6
6
  */
7
7
 
8
8
  'use strict';
@@ -5913,7 +5913,937 @@ var MarsSharedGeometry = /** @class */ (function (_super) {
5913
5913
  return MarsSharedGeometry;
5914
5914
  }(MarsGeometry));
5915
5915
 
5916
- consoleLog('version: ' + "0.3.3-beta.45");
5916
+ const END_BEHAVIOR_DESTROY = 0;
5917
+ const END_BEHAVIOR_PAUSE = 1;
5918
+ const END_BEHAVIOR_FORWARD = 2;
5919
+ const END_BEHAVIOR_PAUSE_AND_DESTROY = 3;
5920
+ const END_BEHAVIOR_FREEZE = 4;
5921
+ const END_BEHAVIOR_RESTART = 5;
5922
+ const END_BEHAVIOR_DESTROY_CHILDREN = 6;
5923
+ const CAMERA_CLIP_MODE_VERTICAL = 1;
5924
+ const CAMERA_CLIP_MODE_NORMAL = 0;
5925
+
5926
+ var ItemEndBehavior;
5927
+ (function (ItemEndBehavior) {
5928
+ ItemEndBehavior[ItemEndBehavior["destroy"] = END_BEHAVIOR_DESTROY] = "destroy";
5929
+ ItemEndBehavior[ItemEndBehavior["loop"] = END_BEHAVIOR_RESTART] = "loop";
5930
+ ItemEndBehavior[ItemEndBehavior["freeze"] = END_BEHAVIOR_FREEZE] = "freeze";
5931
+ ItemEndBehavior[ItemEndBehavior["destroyChildren"] = END_BEHAVIOR_DESTROY_CHILDREN] = "destroyChildren";
5932
+ })(ItemEndBehavior || (ItemEndBehavior = {}));
5933
+
5934
+ var SpriteInteractionBehavior;
5935
+ (function (SpriteInteractionBehavior) {
5936
+ SpriteInteractionBehavior[SpriteInteractionBehavior["none"] = 0] = "none";
5937
+ })(SpriteInteractionBehavior || (SpriteInteractionBehavior = {}));
5938
+
5939
+ //import type { DistortionFilterParams } from './filter-item';
5940
+ /**
5941
+ * 粒子交互行为
5942
+ */
5943
+ var ParticleInteractionBehavior;
5944
+ (function (ParticleInteractionBehavior) {
5945
+ /**
5946
+ * 无
5947
+ */
5948
+ ParticleInteractionBehavior[ParticleInteractionBehavior["none"] = 0] = "none";
5949
+ /**
5950
+ * 移出粒子
5951
+ */
5952
+ ParticleInteractionBehavior[ParticleInteractionBehavior["removeParticle"] = 1] = "removeParticle";
5953
+ })(ParticleInteractionBehavior || (ParticleInteractionBehavior = {}));
5954
+
5955
+ var ShapeArcMode;
5956
+ (function (ShapeArcMode) {
5957
+ /**
5958
+ * 随机
5959
+ */
5960
+ ShapeArcMode[ShapeArcMode["RANDOM"] = 0] = "RANDOM";
5961
+ /**
5962
+ * 单向循环
5963
+ */
5964
+ ShapeArcMode[ShapeArcMode["UNIDIRECTIONAL_CYCLE"] = 1] = "UNIDIRECTIONAL_CYCLE";
5965
+ /**
5966
+ * 双向循环
5967
+ */
5968
+ ShapeArcMode[ShapeArcMode["BIDIRECTIONAL_CYCLE"] = 2] = "BIDIRECTIONAL_CYCLE";
5969
+ /**
5970
+ * 均匀爆发
5971
+ */
5972
+ ShapeArcMode[ShapeArcMode["UNIFORM_BURST"] = 3] = "UNIFORM_BURST";
5973
+ })(ShapeArcMode || (ShapeArcMode = {}));
5974
+
5975
+ var VideoRendererSplitAlpha;
5976
+ (function (VideoRendererSplitAlpha) {
5977
+ VideoRendererSplitAlpha[VideoRendererSplitAlpha["none"] = 2] = "none";
5978
+ VideoRendererSplitAlpha[VideoRendererSplitAlpha["c2a"] = 0] = "c2a";
5979
+ VideoRendererSplitAlpha[VideoRendererSplitAlpha["a2c"] = 1] = "a2c"; // alpha 在左边,color 在右边
5980
+ })(VideoRendererSplitAlpha || (VideoRendererSplitAlpha = {}));
5981
+
5982
+ var LightType;
5983
+ (function (LightType) {
5984
+ LightType["point"] = "point";
5985
+ LightType["spot"] = "spot";
5986
+ LightType["directional"] = "directional";
5987
+ LightType["ambient"] = "ambient";
5988
+ })(LightType || (LightType = {}));
5989
+
5990
+ var ModelBoundingType;
5991
+ (function (ModelBoundingType) {
5992
+ ModelBoundingType[ModelBoundingType["box"] = 2] = "box";
5993
+ ModelBoundingType[ModelBoundingType["sphere"] = 3] = "sphere";
5994
+ })(ModelBoundingType || (ModelBoundingType = {}));
5995
+
5996
+ var TreeAnimPathType;
5997
+ (function (TreeAnimPathType) {
5998
+ TreeAnimPathType[TreeAnimPathType["translation"] = 1] = "translation";
5999
+ TreeAnimPathType[TreeAnimPathType["rotation"] = 2] = "rotation";
6000
+ TreeAnimPathType[TreeAnimPathType["scale"] = 3] = "scale";
6001
+ TreeAnimPathType[TreeAnimPathType["weights"] = 4] = "weights";
6002
+ })(TreeAnimPathType || (TreeAnimPathType = {}));
6003
+ var TreeAnimInterpType;
6004
+ (function (TreeAnimInterpType) {
6005
+ TreeAnimInterpType[TreeAnimInterpType["linear"] = 1] = "linear";
6006
+ TreeAnimInterpType[TreeAnimInterpType["step"] = 2] = "step";
6007
+ TreeAnimInterpType[TreeAnimInterpType["cubicSpline"] = 3] = "cubicSpline";
6008
+ TreeAnimInterpType[TreeAnimInterpType["LINEAR"] = 1] = "LINEAR";
6009
+ TreeAnimInterpType[TreeAnimInterpType["STEP"] = 2] = "STEP";
6010
+ TreeAnimInterpType[TreeAnimInterpType["CUBICSPLINE"] = 3] = "CUBICSPLINE";
6011
+ })(TreeAnimInterpType || (TreeAnimInterpType = {}));
6012
+
6013
+ // 材质类型
6014
+ var MaterialType;
6015
+ (function (MaterialType) {
6016
+ MaterialType["unlit"] = "unlit";
6017
+ MaterialType["pbr"] = "pbr";
6018
+ // 头发材质,在 pbr 材质基础上扩展
6019
+ MaterialType["hair"] = "hair";
6020
+ })(MaterialType || (MaterialType = {}));
6021
+ // 混合模式
6022
+ var MaterialBlending;
6023
+ (function (MaterialBlending) {
6024
+ MaterialBlending[MaterialBlending["opaque"] = 100] = "opaque";
6025
+ MaterialBlending[MaterialBlending["masked"] = 101] = "masked";
6026
+ MaterialBlending[MaterialBlending["translucent"] = 102] = "translucent";
6027
+ MaterialBlending[MaterialBlending["additive"] = 103] = "additive";
6028
+ })(MaterialBlending || (MaterialBlending = {}));
6029
+ // 透明度模式
6030
+ var MaterialAlphaMode;
6031
+ (function (MaterialAlphaMode) {
6032
+ MaterialAlphaMode["OPAQUE"] = "OPAQUE";
6033
+ MaterialAlphaMode["MASK"] = "MASK";
6034
+ MaterialAlphaMode["BLEND"] = "BLEND";
6035
+ })(MaterialAlphaMode || (MaterialAlphaMode = {}));
6036
+
6037
+ /**
6038
+ * 3D渲染模式:将渲染过程中的中间结果输出,主要用于排查渲染效果问题,支持 pbr 和 unlit 材质
6039
+ */
6040
+ var RenderMode3D;
6041
+ (function (RenderMode3D) {
6042
+ /**
6043
+ * 正常渲染
6044
+ */
6045
+ RenderMode3D["none"] = "none";
6046
+ /**
6047
+ * 纹理坐标
6048
+ */
6049
+ RenderMode3D["uv"] = "uv";
6050
+ /**
6051
+ * 世界坐标法线
6052
+ */
6053
+ RenderMode3D["normal"] = "normal";
6054
+ /**
6055
+ * 基础颜色
6056
+ */
6057
+ RenderMode3D["basecolor"] = "basecolor";
6058
+ /**
6059
+ * 基础颜色 Alpha
6060
+ */
6061
+ RenderMode3D["alpha"] = "alpha";
6062
+ /**
6063
+ * 金属度
6064
+ */
6065
+ RenderMode3D["metallic"] = "metallic";
6066
+ /**
6067
+ * 粗超度
6068
+ */
6069
+ RenderMode3D["roughness"] = "roughness";
6070
+ /**
6071
+ * 环境遮蔽
6072
+ */
6073
+ RenderMode3D["ao"] = "ao";
6074
+ /**
6075
+ * 自发光
6076
+ */
6077
+ RenderMode3D["emissive"] = "emissive";
6078
+ })(RenderMode3D || (RenderMode3D = {}));
6079
+ /***
6080
+ * 一个 meshItem 打包出来的 json 案例:
6081
+ *
6082
+ * {
6083
+ * type:'mesh',
6084
+ * pluginName:'model',
6085
+ * content:{
6086
+ * options:{
6087
+ * skins:{},
6088
+ * primitives:[
6089
+ * {
6090
+ * material:{
6091
+ * baseColorFactor:[0,0.5,1,1],
6092
+ * baseColorTexture: {
6093
+ * magFilter:33071,
6094
+ * imageFileId:[0,556,1342]
6095
+ * }
6096
+ * },
6097
+ * geometry:[0,0,556]
6098
+ * }
6099
+ * ]
6100
+ * }
6101
+ *
6102
+ * }
6103
+ * }
6104
+ * bins:[{url:'https://to/some/bin'}]
6105
+ */
6106
+
6107
+ /**
6108
+ * 如果二进制被压缩,js会解码数据,目前默认使用pako
6109
+ */
6110
+ var BinaryCompressMethod;
6111
+ (function (BinaryCompressMethod) {
6112
+ BinaryCompressMethod[BinaryCompressMethod["none"] = 0] = "none";
6113
+ BinaryCompressMethod[BinaryCompressMethod["pako"] = 1] = "pako";
6114
+ })(BinaryCompressMethod || (BinaryCompressMethod = {}));
6115
+ var BinaryEnv;
6116
+ (function (BinaryEnv) {
6117
+ BinaryEnv["fileSystem"] = "fs";
6118
+ BinaryEnv["runtime"] = "runtime";
6119
+ BinaryEnv["json"] = "json";
6120
+ })(BinaryEnv || (BinaryEnv = {}));
6121
+
6122
+ var CameraClipMode;
6123
+ (function (CameraClipMode) {
6124
+ /**
6125
+ * 剪裁上下
6126
+ */
6127
+ CameraClipMode[CameraClipMode["portrait"] = CAMERA_CLIP_MODE_VERTICAL] = "portrait";
6128
+ /**
6129
+ * 剪裁左右
6130
+ */
6131
+ CameraClipMode[CameraClipMode["landscape"] = CAMERA_CLIP_MODE_NORMAL] = "landscape";
6132
+ })(CameraClipMode || (CameraClipMode = {}));
6133
+ /**
6134
+ * 结束行为
6135
+ */
6136
+ var CompositionEndBehavior;
6137
+ (function (CompositionEndBehavior) {
6138
+ /**
6139
+ * 销毁
6140
+ */
6141
+ CompositionEndBehavior[CompositionEndBehavior["destroy"] = END_BEHAVIOR_DESTROY] = "destroy";
6142
+ /**
6143
+ * 暂停
6144
+ */
6145
+ CompositionEndBehavior[CompositionEndBehavior["pause"] = END_BEHAVIOR_PAUSE] = "pause";
6146
+ /**
6147
+ * 重播
6148
+ */
6149
+ CompositionEndBehavior[CompositionEndBehavior["restart"] = END_BEHAVIOR_RESTART] = "restart";
6150
+ /**
6151
+ * 无限播放
6152
+ */
6153
+ CompositionEndBehavior[CompositionEndBehavior["forward"] = END_BEHAVIOR_FORWARD] = "forward";
6154
+ /**
6155
+ * 销毁并保留最后一帧
6156
+ */
6157
+ CompositionEndBehavior[CompositionEndBehavior["pause_destroy"] = END_BEHAVIOR_PAUSE_AND_DESTROY] = "pause_destroy";
6158
+ })(CompositionEndBehavior || (CompositionEndBehavior = {}));
6159
+
6160
+ var TextOverflow;
6161
+ (function (TextOverflow) {
6162
+ // default, display all text, it may decrease letter space size
6163
+ TextOverflow[TextOverflow["display"] = 0] = "display";
6164
+ // clip overflowed text
6165
+ TextOverflow[TextOverflow["clip"] = 1] = "clip";
6166
+ // use icon('..') to replace overflowed text
6167
+ TextOverflow[TextOverflow["ellipsis"] = 2] = "ellipsis";
6168
+ })(TextOverflow || (TextOverflow = {}));
6169
+ var TextAlignment;
6170
+ (function (TextAlignment) {
6171
+ /**
6172
+ * text alignment starts from(x,y) to right direction
6173
+ * 从(x,y)开始第一个字符,向右边延伸
6174
+ */
6175
+ TextAlignment[TextAlignment["left"] = 0] = "left";
6176
+ /**
6177
+ * (x,y) is middle position of text, where (left + right)/2 =(x,y)
6178
+ * (x,y) 为文字中间位置,(最左位置 + 最右位置)/2 = (x,y)
6179
+ */
6180
+ TextAlignment[TextAlignment["middle"] = 1] = "middle";
6181
+ /**
6182
+ * text alignment ends with(x,y) from left direction
6183
+ * 从(x,y)结束最后一个字符,向左边延伸
6184
+ */
6185
+ TextAlignment[TextAlignment["right"] = 2] = "right";
6186
+ })(TextAlignment || (TextAlignment = {}));
6187
+ var FontStyle;
6188
+ (function (FontStyle) {
6189
+ FontStyle[FontStyle["normal"] = 0] = "normal";
6190
+ FontStyle[FontStyle["italic"] = 1] = "italic";
6191
+ FontStyle[FontStyle["oblique"] = 2] = "oblique";
6192
+ })(FontStyle || (FontStyle = {}));
6193
+
6194
+ /*********************************************/
6195
+ /* 元素属性参数类型 */
6196
+ /*********************************************/
6197
+ /**
6198
+ * 渲染等级
6199
+ */
6200
+ var RenderLevel;
6201
+ (function (RenderLevel) {
6202
+ RenderLevel["S"] = "S";
6203
+ RenderLevel["APlus"] = "A+";
6204
+ RenderLevel["A"] = "A";
6205
+ RenderLevel["BPlus"] = "B+";
6206
+ RenderLevel["B"] = "B";
6207
+ RenderLevel["F"] = "F";
6208
+ })(RenderLevel || (RenderLevel = {}));
6209
+ /**
6210
+ * 混合模式
6211
+ */
6212
+ var BlendingMode;
6213
+ (function (BlendingMode) {
6214
+ /**
6215
+ * 普通混合模式
6216
+ */
6217
+ BlendingMode[BlendingMode["alpha"] = 0] = "alpha";
6218
+ /**
6219
+ * 叠加混合模式
6220
+ */
6221
+ BlendingMode[BlendingMode["ADD"] = 1] = "ADD";
6222
+ /**
6223
+ * 相乘混合模式
6224
+ */
6225
+ BlendingMode[BlendingMode["MULTIPLY"] = 2] = "MULTIPLY";
6226
+ /**
6227
+ * 亮度混合模式
6228
+ */
6229
+ BlendingMode[BlendingMode["BRIGHTNESS"] = 3] = "BRIGHTNESS";
6230
+ /**
6231
+ * 减色混合模式
6232
+ */
6233
+ BlendingMode[BlendingMode["SUBTRACTION"] = 4] = "SUBTRACTION";
6234
+ /**
6235
+ * 强光混合模式
6236
+ */
6237
+ BlendingMode[BlendingMode["STRONG_LIGHT"] = 5] = "STRONG_LIGHT";
6238
+ /**
6239
+ * 弱光混合模式
6240
+ */
6241
+ BlendingMode[BlendingMode["WEAK_LIGHT"] = 6] = "WEAK_LIGHT";
6242
+ /**
6243
+ * 亮度叠加混合模式
6244
+ */
6245
+ BlendingMode[BlendingMode["SUPERPOSITION"] = 7] = "SUPERPOSITION";
6246
+ })(BlendingMode || (BlendingMode = {}));
6247
+ /**
6248
+ * 单双面模式
6249
+ */
6250
+ var SideMode;
6251
+ (function (SideMode) {
6252
+ /**
6253
+ * 双面模式
6254
+ */
6255
+ SideMode[SideMode["DOUBLE"] = 1032] = "DOUBLE";
6256
+ /**
6257
+ * 正面模式
6258
+ */
6259
+ SideMode[SideMode["FRONT"] = 1028] = "FRONT";
6260
+ /**
6261
+ * 背面模式
6262
+ */
6263
+ SideMode[SideMode["BACK"] = 1029] = "BACK";
6264
+ })(SideMode || (SideMode = {}));
6265
+ /**
6266
+ * 蒙版模式
6267
+ */
6268
+ var MaskMode;
6269
+ (function (MaskMode) {
6270
+ /**
6271
+ * 无蒙版
6272
+ */
6273
+ MaskMode[MaskMode["NONE"] = 0] = "NONE";
6274
+ /**
6275
+ * 蒙版
6276
+ */
6277
+ MaskMode[MaskMode["MASK"] = 1] = "MASK";
6278
+ /**
6279
+ * 被遮挡
6280
+ */
6281
+ MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
6282
+ /**
6283
+ * 被反向遮挡
6284
+ */
6285
+ MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
6286
+ })(MaskMode || (MaskMode = {}));
6287
+ /**
6288
+ * 发射器形状
6289
+ */
6290
+ var ShapeType;
6291
+ (function (ShapeType) {
6292
+ /**
6293
+ * 没有类型
6294
+ */
6295
+ ShapeType[ShapeType["NONE"] = 0] = "NONE";
6296
+ /**
6297
+ * 圆球
6298
+ */
6299
+ ShapeType[ShapeType["SPHERE"] = 1] = "SPHERE";
6300
+ /**
6301
+ * 圆锥
6302
+ */
6303
+ ShapeType[ShapeType["CONE"] = 2] = "CONE";
6304
+ /**
6305
+ * 半球
6306
+ */
6307
+ ShapeType[ShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
6308
+ /**
6309
+ * 圆
6310
+ */
6311
+ ShapeType[ShapeType["CIRCLE"] = 4] = "CIRCLE";
6312
+ /**
6313
+ * 圆环
6314
+ */
6315
+ ShapeType[ShapeType["DONUT"] = 5] = "DONUT";
6316
+ /**
6317
+ * 矩形
6318
+ */
6319
+ ShapeType[ShapeType["RECTANGLE"] = 6] = "RECTANGLE";
6320
+ /**
6321
+ * 矩形框
6322
+ */
6323
+ ShapeType[ShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
6324
+ /**
6325
+ * 直线
6326
+ */
6327
+ ShapeType[ShapeType["EDGE"] = 8] = "EDGE";
6328
+ /**
6329
+ * 贴图
6330
+ */
6331
+ ShapeType[ShapeType["TEXTURE"] = 9] = "TEXTURE";
6332
+ })(ShapeType || (ShapeType = {}));
6333
+ /**
6334
+ * 插件类型
6335
+ */
6336
+ var PluginType;
6337
+ (function (PluginType) {
6338
+ /**
6339
+ * 陀螺仪
6340
+ */
6341
+ PluginType[PluginType["GYROSCOPE"] = 0] = "GYROSCOPE";
6342
+ /**
6343
+ * Spine
6344
+ */
6345
+ PluginType[PluginType["SPINE"] = 1] = "SPINE";
6346
+ })(PluginType || (PluginType = {}));
6347
+ /**
6348
+ * 交互类型
6349
+ */
6350
+ var InteractType;
6351
+ (function (InteractType) {
6352
+ /**
6353
+ * 点击
6354
+ */
6355
+ InteractType[InteractType["CLICK"] = 0] = "CLICK";
6356
+ /**
6357
+ * 消息,
6358
+ * 前端收到onMessageItem回调
6359
+ */
6360
+ InteractType[InteractType["MESSAGE"] = 1] = "MESSAGE";
6361
+ /**
6362
+ * 拖拽
6363
+ */
6364
+ InteractType[InteractType["DRAG"] = 2] = "DRAG";
6365
+ InteractType[InteractType["LOOP"] = 3] = "LOOP";
6366
+ })(InteractType || (InteractType = {}));
6367
+ /**
6368
+ * 交互行为
6369
+ */
6370
+ var InteractBehavior;
6371
+ (function (InteractBehavior) {
6372
+ /**
6373
+ * 无
6374
+ */
6375
+ InteractBehavior[InteractBehavior["NONE"] = 0] = "NONE";
6376
+ /**
6377
+ * 通知
6378
+ */
6379
+ InteractBehavior[InteractBehavior["NOTIFY"] = 1] = "NOTIFY";
6380
+ /**
6381
+ * 重置播放器
6382
+ */
6383
+ InteractBehavior[InteractBehavior["RESUME_PLAYER"] = 2] = "RESUME_PLAYER";
6384
+ /**
6385
+ * 清除元素
6386
+ */
6387
+ InteractBehavior[InteractBehavior["REMOVE"] = 3] = "REMOVE";
6388
+ /**
6389
+ * 暂停播放器
6390
+ */
6391
+ InteractBehavior[InteractBehavior["PAUSE"] = 4] = "PAUSE";
6392
+ })(InteractBehavior || (InteractBehavior = {}));
6393
+ /**
6394
+ * 元素类型
6395
+ */
6396
+ var ItemType;
6397
+ (function (ItemType) {
6398
+ /**
6399
+ * 错误元素
6400
+ */
6401
+ ItemType["base"] = "0";
6402
+ /**
6403
+ * 图层元素
6404
+ */
6405
+ ItemType["sprite"] = "1";
6406
+ /**
6407
+ * 粒子元素
6408
+ */
6409
+ ItemType["particle"] = "2";
6410
+ /**
6411
+ * 空节点元素
6412
+ */
6413
+ ItemType["null"] = "3";
6414
+ /**
6415
+ * 交互元素
6416
+ */
6417
+ ItemType["interact"] = "4";
6418
+ /**
6419
+ * 插件元素
6420
+ */
6421
+ ItemType["plugin"] = "5";
6422
+ /**
6423
+ * 相机元素
6424
+ */
6425
+ ItemType["camera"] = "6";
6426
+ /**
6427
+ * 预合成元素
6428
+ */
6429
+ ItemType["composition"] = "7";
6430
+ /**
6431
+ * 滤镜图层
6432
+ */
6433
+ ItemType["filter"] = "8";
6434
+ /**
6435
+ * text 元素
6436
+ */
6437
+ ItemType["text"] = "9";
6438
+ ItemType["tree"] = "tree";
6439
+ /**
6440
+ * Mesh 元素
6441
+ */
6442
+ ItemType["mesh"] = "mesh";
6443
+ ItemType["light"] = "light";
6444
+ /**
6445
+ * 天空盒元素
6446
+ */
6447
+ ItemType["skybox"] = "skybox";
6448
+ /**
6449
+ * Spine元素
6450
+ */
6451
+ ItemType["spine"] = "spi";
6452
+ ItemType["video"] = "av";
6453
+ })(ItemType || (ItemType = {}));
6454
+ /**
6455
+ * 渲染模式
6456
+ */
6457
+ var RenderMode;
6458
+ (function (RenderMode) {
6459
+ /**
6460
+ * 广告牌模式
6461
+ */
6462
+ RenderMode[RenderMode["BILLBOARD"] = 0] = "BILLBOARD";
6463
+ /**
6464
+ * 网格模式
6465
+ */
6466
+ RenderMode[RenderMode["MESH"] = 1] = "MESH";
6467
+ /**
6468
+ * 垂直广告牌模式
6469
+ */
6470
+ RenderMode[RenderMode["VERTICAL_BILLBOARD"] = 2] = "VERTICAL_BILLBOARD";
6471
+ /**
6472
+ * 水平广告牌模式
6473
+ */
6474
+ RenderMode[RenderMode["HORIZONTAL_BILLBOARD"] = 3] = "HORIZONTAL_BILLBOARD";
6475
+ })(RenderMode || (RenderMode = {}));
6476
+ /**
6477
+ * 变换中心
6478
+ */
6479
+ var ParticleOrigin;
6480
+ (function (ParticleOrigin) {
6481
+ /**
6482
+ * 水平和垂直中点
6483
+ */
6484
+ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_CENTER"] = 0] = "PARTICLE_ORIGIN_CENTER";
6485
+ /**
6486
+ * 水平左侧 垂直顶部
6487
+ */
6488
+ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_LEFT_TOP"] = 1] = "PARTICLE_ORIGIN_LEFT_TOP";
6489
+ /**
6490
+ * 水平左侧 垂直中间
6491
+ */
6492
+ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_LEFT_CENTER"] = 2] = "PARTICLE_ORIGIN_LEFT_CENTER";
6493
+ /**
6494
+ * 水平左侧 垂直底部
6495
+ */
6496
+ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_LEFT_BOTTOM"] = 3] = "PARTICLE_ORIGIN_LEFT_BOTTOM";
6497
+ /**
6498
+ * 水平中间 垂直顶部
6499
+ */
6500
+ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_CENTER_TOP"] = 4] = "PARTICLE_ORIGIN_CENTER_TOP";
6501
+ /**
6502
+ * 水平中间 垂直底部
6503
+ */
6504
+ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_CENTER_BOTTOM"] = 5] = "PARTICLE_ORIGIN_CENTER_BOTTOM";
6505
+ /**
6506
+ * 水平右侧 垂直顶部
6507
+ */
6508
+ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_RIGHT_TOP"] = 6] = "PARTICLE_ORIGIN_RIGHT_TOP";
6509
+ /**
6510
+ * 水平右侧 垂直中间
6511
+ */
6512
+ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_RIGHT_CENTER"] = 7] = "PARTICLE_ORIGIN_RIGHT_CENTER";
6513
+ /**
6514
+ * 水平右侧 垂直底部
6515
+ */
6516
+ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_RIGHT_BOTTOM"] = 8] = "PARTICLE_ORIGIN_RIGHT_BOTTOM";
6517
+ })(ParticleOrigin || (ParticleOrigin = {}));
6518
+
6519
+ /*********************************************/
6520
+ /* 基本数值属性参数 */
6521
+ var ValueType;
6522
+ (function (ValueType) {
6523
+ /**
6524
+ * 常数
6525
+ */
6526
+ ValueType[ValueType["CONSTANT"] = 0] = "CONSTANT";
6527
+ /**
6528
+ * 二维常数向量
6529
+ */
6530
+ ValueType[ValueType["CONSTANT_VEC2"] = 1] = "CONSTANT_VEC2";
6531
+ /**
6532
+ * 三维常数向量
6533
+ */
6534
+ ValueType[ValueType["CONSTANT_VEC3"] = 2] = "CONSTANT_VEC3";
6535
+ /**
6536
+ * 四维常数向量
6537
+ */
6538
+ ValueType[ValueType["CONSTANT_VEC4"] = 3] = "CONSTANT_VEC4";
6539
+ /**
6540
+ * 随机数
6541
+ */
6542
+ ValueType[ValueType["RANDOM"] = 4] = "RANDOM";
6543
+ /**
6544
+ * 直线
6545
+ */
6546
+ ValueType[ValueType["LINE"] = 5] = "LINE";
6547
+ /**
6548
+ * 曲线
6549
+ */
6550
+ ValueType[ValueType["CURVE"] = 6] = "CURVE";
6551
+ /**
6552
+ * 贝塞尔路径
6553
+ */
6554
+ ValueType[ValueType["BEZIER_PATH"] = 7] = "BEZIER_PATH";
6555
+ /**
6556
+ * 颜色
6557
+ */
6558
+ ValueType[ValueType["RGBA_COLOR"] = 8] = "RGBA_COLOR";
6559
+ /**
6560
+ * 渐变色
6561
+ */
6562
+ ValueType[ValueType["GRADIENT_COLOR"] = 9] = "GRADIENT_COLOR";
6563
+ /**
6564
+ * 蒙版形状点集
6565
+ */
6566
+ ValueType[ValueType["SHAPE_POINTS"] = 10] = "SHAPE_POINTS";
6567
+ /**
6568
+ * 蒙版形状切分
6569
+ */
6570
+ ValueType[ValueType["SHAPE_SPLITS"] = 11] = "SHAPE_SPLITS";
6571
+ /**
6572
+ *直线路径
6573
+ */
6574
+ ValueType[ValueType["LINEAR_PATH"] = 12] = "LINEAR_PATH";
6575
+ /**
6576
+ * 多色
6577
+ */
6578
+ ValueType[ValueType["COLORS"] = 13] = "COLORS";
6579
+ ValueType[ValueType["BEZIER"] = 14] = "BEZIER";
6580
+ /**
6581
+ * 二进制指针
6582
+ */
6583
+ ValueType[ValueType["BINARY"] = 20] = "BINARY";
6584
+ ValueType[ValueType["BINARY_BEZIER"] = 21] = "BINARY_BEZIER";
6585
+ ValueType[ValueType["BINARY_BEZIER_PATH"] = 22] = "BINARY_BEZIER_PATH";
6586
+ })(ValueType || (ValueType = {}));
6587
+ var VideoFrameFormat;
6588
+ (function (VideoFrameFormat) {
6589
+ VideoFrameFormat[VideoFrameFormat["RGB"] = 3] = "RGB";
6590
+ VideoFrameFormat[VideoFrameFormat["NV12"] = 1] = "NV12";
6591
+ VideoFrameFormat[VideoFrameFormat["I420"] = 2] = "I420";
6592
+ VideoFrameFormat[VideoFrameFormat["I420A"] = 4] = "I420A";
6593
+ })(VideoFrameFormat || (VideoFrameFormat = {}));
6594
+
6595
+ var EventSystemEnv;
6596
+ (function (EventSystemEnv) {
6597
+ EventSystemEnv[EventSystemEnv["web"] = 0] = "web";
6598
+ EventSystemEnv[EventSystemEnv["rn"] = 1] = "rn";
6599
+ EventSystemEnv[EventSystemEnv["simulator"] = 2] = "simulator";
6600
+ })(EventSystemEnv || (EventSystemEnv = {}));
6601
+ const EVENT_TYPE_CLICK = 'click';
6602
+ const EVENT_TYPE_TOUCH_START = 'touchstart';
6603
+ const EVENT_TYPE_TOUCH_MOVE = 'touchmove';
6604
+ const EVENT_TYPE_TOUCH_END = 'touchend';
6605
+
6606
+ var BaseEventHandler = /** @class */ (function () {
6607
+ function BaseEventHandler(system) {
6608
+ this.system = system;
6609
+ }
6610
+ BaseEventHandler.prototype.genArg = function (e, x, y, dx, dy) {
6611
+ if (dx === void 0) { dx = 0; }
6612
+ if (dy === void 0) { dy = 0; }
6613
+ var vx = 0;
6614
+ var vy = 0;
6615
+ var timestamp = Date.now();
6616
+ if (this.lastTouch) {
6617
+ var dt = timestamp - this.lastTouch.ts;
6618
+ vx = ((dx - this.lastTouch.dx) / dt) || 0;
6619
+ vy = ((dy - this.lastTouch.dy) / dt) || 0;
6620
+ this.lastTouch = { dx: dx, dy: dy, ts: timestamp };
6621
+ }
6622
+ return {
6623
+ x: x,
6624
+ y: y,
6625
+ vx: vx,
6626
+ vy: vy,
6627
+ ts: timestamp,
6628
+ dx: dx,
6629
+ dy: dy,
6630
+ width: this.system.target.width,
6631
+ height: this.system.target.height,
6632
+ origin: e,
6633
+ };
6634
+ };
6635
+ return BaseEventHandler;
6636
+ }());
6637
+ var WebEventHandler = /** @class */ (function (_super) {
6638
+ __extends(WebEventHandler, _super);
6639
+ function WebEventHandler() {
6640
+ var _this = _super !== null && _super.apply(this, arguments) || this;
6641
+ _this.handlers = {};
6642
+ _this.isSimulator = false;
6643
+ return _this;
6644
+ }
6645
+ WebEventHandler.prototype.setup = function () {
6646
+ var _a;
6647
+ var _this = this;
6648
+ var target = this.system.target;
6649
+ var isTouch = this.isSimulator;
6650
+ var eventMap = {
6651
+ start: isTouch ? 'touchstart' : 'mousedown',
6652
+ move: isTouch ? 'touchmove' : 'mousemove',
6653
+ end: isTouch ? 'touchend' : 'mouseup',
6654
+ };
6655
+ this.handlers = (_a = {},
6656
+ _a[eventMap.start] = function (e) { return _this.handleStart(e); },
6657
+ _a[eventMap.move] = function (e) { return _this.handleMove(e); },
6658
+ _a[eventMap.end] = function (e) { return _this.handleEnd(e); },
6659
+ _a);
6660
+ Object.entries(this.handlers).forEach(function (_a) {
6661
+ var event = _a[0], handler = _a[1];
6662
+ target.addEventListener(event, handler);
6663
+ });
6664
+ };
6665
+ WebEventHandler.prototype.teardown = function () {
6666
+ var target = this.system.target;
6667
+ Object.entries(this.handlers).forEach(function (_a) {
6668
+ var event = _a[0], handler = _a[1];
6669
+ target.removeEventListener(event, handler);
6670
+ });
6671
+ this.handlers = {};
6672
+ };
6673
+ WebEventHandler.prototype.getTouch = function (e) {
6674
+ var _a, _b;
6675
+ return this.isSimulator ? ((_a = e.touches) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = e.changedTouches) === null || _b === void 0 ? void 0 : _b[0]) : e;
6676
+ };
6677
+ WebEventHandler.prototype.handleStart = function (e) {
6678
+ if (!this.system.enabled) {
6679
+ return;
6680
+ }
6681
+ var touch = this.getTouch(e);
6682
+ var _a = this.getCoord(touch), x = _a.x, y = _a.y;
6683
+ this.lastTouch = this.currentTouch = {
6684
+ clientX: touch.clientX,
6685
+ clientY: touch.clientY,
6686
+ ts: Date.now(),
6687
+ x: x,
6688
+ y: y,
6689
+ };
6690
+ this.system.dispatchEvent(EVENT_TYPE_TOUCH_START, this.genArg(e, x, y));
6691
+ };
6692
+ WebEventHandler.prototype.handleMove = function (e) {
6693
+ if (!this.currentTouch || !this.system.enabled) {
6694
+ return;
6695
+ }
6696
+ var touch = this.getTouch(e);
6697
+ var _a = this.getCoord(touch), x = _a.x, y = _a.y;
6698
+ this.system.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, this.genArg(e, x, y, x - this.currentTouch.x, y - this.currentTouch.y));
6699
+ };
6700
+ WebEventHandler.prototype.handleEnd = function (e) {
6701
+ if (!this.currentTouch || !this.system.enabled) {
6702
+ return;
6703
+ }
6704
+ var touch = this.getTouch(e);
6705
+ var _a = this.getCoord(touch), x = _a.x, y = _a.y;
6706
+ var dt = Math.abs(this.currentTouch.clientX - touch.clientX) +
6707
+ Math.abs(this.currentTouch.clientY - touch.clientY);
6708
+ if (dt < 4) {
6709
+ this.system.dispatchEvent(EVENT_TYPE_CLICK, this.genArg(e, x, y));
6710
+ }
6711
+ this.system.dispatchEvent(EVENT_TYPE_TOUCH_END, this.genArg(e, x, y, x - this.currentTouch.x, y - this.currentTouch.y));
6712
+ e.preventDefault();
6713
+ e.stopPropagation();
6714
+ this.currentTouch = null;
6715
+ };
6716
+ WebEventHandler.prototype.getCoord = function (e) {
6717
+ var target = this.system.target;
6718
+ var bounding = target.getBoundingClientRect();
6719
+ return {
6720
+ x: ((e.clientX - bounding.left) / bounding.width) * 2 - 1,
6721
+ y: 1 - ((e.clientY - bounding.top) / bounding.height) * 2,
6722
+ };
6723
+ };
6724
+ return WebEventHandler;
6725
+ }(BaseEventHandler));
6726
+ var RNEventHandler = /** @class */ (function (_super) {
6727
+ __extends(RNEventHandler, _super);
6728
+ function RNEventHandler() {
6729
+ var _this = _super !== null && _super.apply(this, arguments) || this;
6730
+ _this.handlers = {};
6731
+ return _this;
6732
+ }
6733
+ RNEventHandler.prototype.setup = function () {
6734
+ var _this = this;
6735
+ var target = this.system.target; // 假设RN的Canvas有on方法
6736
+ this.handlers = {
6737
+ touchstart: function (e) { return _this.handleStart(e); },
6738
+ touchmove: function (e) { return _this.handleMove(e); },
6739
+ touchend: function (e) { return _this.handleEnd(e); },
6740
+ };
6741
+ Object.entries(this.handlers).forEach(function (_a) {
6742
+ var event = _a[0], handler = _a[1];
6743
+ target.on(event, handler);
6744
+ });
6745
+ };
6746
+ RNEventHandler.prototype.teardown = function () {
6747
+ var target = this.system.target;
6748
+ Object.entries(this.handlers).forEach(function (_a) {
6749
+ var event = _a[0], handler = _a[1];
6750
+ target.off(event, handler);
6751
+ });
6752
+ this.handlers = {};
6753
+ };
6754
+ RNEventHandler.prototype.handleStart = function (e) {
6755
+ if (!this.system.enabled) {
6756
+ return;
6757
+ }
6758
+ var touch = e.touch;
6759
+ var _a = this.getCoord(touch), x = _a.x, y = _a.y;
6760
+ this.lastTouch = this.currentTouch = {
6761
+ clientX: touch.clientX,
6762
+ clientY: touch.clientY,
6763
+ ts: Date.now(),
6764
+ x: x,
6765
+ y: y,
6766
+ };
6767
+ this.system.dispatchEvent(EVENT_TYPE_TOUCH_START, this.genArg(e, x, y));
6768
+ };
6769
+ RNEventHandler.prototype.handleMove = function (e) {
6770
+ if (!this.currentTouch || !this.system.enabled) {
6771
+ return;
6772
+ }
6773
+ var touch = e.touch;
6774
+ var _a = this.getCoord(touch), x = _a.x, y = _a.y;
6775
+ this.system.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, this.genArg(e, x, y, x - this.currentTouch.x, y - this.currentTouch.y));
6776
+ };
6777
+ RNEventHandler.prototype.handleEnd = function (e) {
6778
+ if (!this.currentTouch || !this.system.enabled) {
6779
+ return;
6780
+ }
6781
+ var touch = e.touch;
6782
+ var _a = this.getCoord(touch), x = _a.x, y = _a.y;
6783
+ this.system.dispatchEvent(EVENT_TYPE_TOUCH_END, this.genArg(e, x, y, x - this.currentTouch.x, y - this.currentTouch.y));
6784
+ this.currentTouch = null;
6785
+ };
6786
+ RNEventHandler.prototype.getCoord = function (e) {
6787
+ var _a = e.layout, width = _a.width, height = _a.height;
6788
+ return {
6789
+ x: (e.clientX / width) * 2 - 1,
6790
+ y: 1 - (e.clientY / height) * 2,
6791
+ };
6792
+ };
6793
+ return RNEventHandler;
6794
+ }(BaseEventHandler));
6795
+ var PredyEventSystem = /** @class */ (function () {
6796
+ function PredyEventSystem(target, env) {
6797
+ this.target = target;
6798
+ this._handlerMap = {};
6799
+ this._enabled = true;
6800
+ switch (env) {
6801
+ case EventSystemEnv.web:
6802
+ this._platformHandler = new WebEventHandler(this);
6803
+ break;
6804
+ case EventSystemEnv.simulator:
6805
+ this._platformHandler = new WebEventHandler(this);
6806
+ this._platformHandler.isSimulator = true;
6807
+ break;
6808
+ case EventSystemEnv.rn:
6809
+ this._platformHandler = new RNEventHandler(this);
6810
+ break;
6811
+ default:
6812
+ throw new Error('Unsupported platform');
6813
+ }
6814
+ this._platformHandler.setup();
6815
+ }
6816
+ Object.defineProperty(PredyEventSystem.prototype, "enabled", {
6817
+ get: function () {
6818
+ return this._enabled;
6819
+ },
6820
+ set: function (value) {
6821
+ this._enabled = value;
6822
+ },
6823
+ enumerable: false,
6824
+ configurable: true
6825
+ });
6826
+ PredyEventSystem.prototype.dispatchEvent = function (type, e) {
6827
+ var _a;
6828
+ (_a = this._handlerMap[type]) === null || _a === void 0 ? void 0 : _a.forEach(function (handler) { return handler(e); });
6829
+ };
6830
+ PredyEventSystem.prototype.addEventListener = function (type, handler) {
6831
+ var _this = this;
6832
+ var handlers = this._handlerMap[type] || (this._handlerMap[type] = []);
6833
+ arrAdd(handlers, handler);
6834
+ return function () { return _this.removeEventListener(type, handler); };
6835
+ };
6836
+ PredyEventSystem.prototype.removeEventListener = function (type, handler) {
6837
+ arrRemove(this._handlerMap[type], handler);
6838
+ };
6839
+ PredyEventSystem.prototype.destroy = function () {
6840
+ this._platformHandler.teardown();
6841
+ this._handlerMap = {};
6842
+ };
6843
+ return PredyEventSystem;
6844
+ }());
6845
+
6846
+ consoleLog('version: ' + "0.3.3-beta.47");
5917
6847
  var ModuleMsg = 'RI Package: @predy-js/render-interface';
5918
6848
 
5919
6849
  var RI = /*#__PURE__*/Object.freeze({
@@ -5934,6 +6864,7 @@ var RI = /*#__PURE__*/Object.freeze({
5934
6864
  getDefaultTextureFactory: getDefaultTextureFactory,
5935
6865
  setDefaultTextureFactory: setDefaultTextureFactory,
5936
6866
  MarsTextureFactory: MarsTextureFactory,
6867
+ EventSystem: PredyEventSystem,
5937
6868
  get DestroyOptions () { return exports.DestroyOptions; },
5938
6869
  get PredyTextEncoding () { return exports.PredyTextEncoding; },
5939
6870
  get PredyVideoCodec () { return exports.PredyVideoCodec; },
@@ -5959,6 +6890,7 @@ else if (typeof global === 'object') {
5959
6890
  global.PredyRI = RI;
5960
6891
  }
5961
6892
 
6893
+ exports.EventSystem = PredyEventSystem;
5962
6894
  exports.GPUBufferOptionsMemoryShared = GPUBufferOptionsMemoryShared;
5963
6895
  exports.Geometry = MarsGeometry;
5964
6896
  exports.InstancedMesh = MarsInstancedMesh;