@galacean/effects-plugin-model 2.8.0-alpha.3 → 2.8.0-alpha.4

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,11 +3,11 @@
3
3
  * Description: Galacean Effects player model plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 飂兮
6
- * Version: v2.8.0-alpha.3
6
+ * Version: v2.8.0-alpha.4
7
7
  */
8
8
 
9
9
  import * as EFFECTS from '@galacean/effects';
10
- import { math, spec, Transform, PLAYER_OPTIONS_ENV_EDITOR, RenderPassAttachmentStorageType, glContext, Material, Mesh, Geometry, ShaderFactory, effectsClass, RendererComponent, Behaviour, HitTestType, AnimationClip, TextureSourceType, Texture, DestroyOptions, RenderPassDestroyAttachmentType, GLSLVersion, Player, Renderer, getDefaultTextureFactory, loadImage, generateGUID, addItem, removeItem, VFXItem, AbstractPlugin, glType2VertexFormatType, Downloader, getStandardJSON, isObject, registerPlugin, logger } from '@galacean/effects';
10
+ import { math, spec, Transform, PLAYER_OPTIONS_ENV_EDITOR, RenderPassAttachmentStorageType, glContext, Material, Mesh, Geometry, ShaderFactory, effectsClass, HitTestType, RendererComponent, Behaviour, AnimationClip, TextureSourceType, Texture, DestroyOptions, RenderPassDestroyAttachmentType, GLSLVersion, Player, Renderer, getDefaultTextureFactory, loadImage, generateGUID, addItem, removeItem, VFXItem, Plugin, glType2VertexFormatType, Downloader, getStandardJSON, isObject, registerPlugin, logger } from '@galacean/effects';
11
11
 
12
12
  /**
13
13
  * Model 插件元素类型
@@ -68,6 +68,74 @@ function _instanceof1(left, right) {
68
68
  } else return _instanceof1(left, right);
69
69
  }
70
70
 
71
+ function _is_native_reflect_construct() {
72
+ // Since Reflect.construct can't be properly polyfilled, some
73
+ // implementations (e.g. core-js@2) don't set the correct internal slots.
74
+ // Those polyfills don't allow us to subclass built-ins, so we need to
75
+ // use our fallback implementation.
76
+ try {
77
+ // If the internal slots aren't set, this throws an error similar to
78
+ // TypeError: this is not a Boolean object.
79
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
80
+ } catch (_) {}
81
+ return (_is_native_reflect_construct = function _is_native_reflect_construct() {
82
+ return !!result;
83
+ })();
84
+ }
85
+
86
+ function _construct(Parent, args, Class) {
87
+ if (_is_native_reflect_construct()) _construct = Reflect.construct;
88
+ else {
89
+ _construct = function construct(Parent, args, Class) {
90
+ var a = [
91
+ null
92
+ ];
93
+ a.push.apply(a, args);
94
+ var Constructor = Function.bind.apply(Parent, a);
95
+ var instance = new Constructor();
96
+ if (Class) _set_prototype_of(instance, Class.prototype);
97
+ return instance;
98
+ };
99
+ }
100
+ return _construct.apply(null, arguments);
101
+ }
102
+
103
+ function _get_prototype_of(o) {
104
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
105
+ return o.__proto__ || Object.getPrototypeOf(o);
106
+ };
107
+ return _get_prototype_of(o);
108
+ }
109
+
110
+ function _is_native_function(fn) {
111
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
112
+ }
113
+
114
+ function _wrap_native_super(Class) {
115
+ var _cache = typeof Map === "function" ? new Map() : undefined;
116
+ _wrap_native_super = function _wrap_native_super(Class) {
117
+ if (Class === null || !_is_native_function(Class)) return Class;
118
+ if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
119
+ if (typeof _cache !== "undefined") {
120
+ if (_cache.has(Class)) return _cache.get(Class);
121
+ _cache.set(Class, Wrapper);
122
+ }
123
+ function Wrapper() {
124
+ return _construct(Class, arguments, _get_prototype_of(this).constructor);
125
+ }
126
+ Wrapper.prototype = Object.create(Class.prototype, {
127
+ constructor: {
128
+ value: Wrapper,
129
+ enumerable: false,
130
+ writable: true,
131
+ configurable: true
132
+ }
133
+ });
134
+ return _set_prototype_of(Wrapper, Class);
135
+ };
136
+ return _wrap_native_super(Class);
137
+ }
138
+
71
139
  function __decorate(decorators, target, key, desc) {
72
140
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
73
141
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -9155,18 +9223,18 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
9155
9223
 
9156
9224
  /**
9157
9225
  * Model 插件类,负责支持播放器中的 3D 功能
9158
- */ var ModelPlugin = /*#__PURE__*/ function(AbstractPlugin) {
9159
- _inherits(ModelPlugin, AbstractPlugin);
9226
+ */ var ModelPlugin = /*#__PURE__*/ function(Plugin) {
9227
+ _inherits(ModelPlugin, Plugin);
9160
9228
  function ModelPlugin() {
9161
9229
  var _this;
9162
- _this = AbstractPlugin.apply(this, arguments) || this;
9230
+ _this = Plugin.apply(this, arguments) || this;
9163
9231
  /**
9164
9232
  * 插件名称
9165
9233
  */ _this.name = "model";
9166
9234
  return _this;
9167
9235
  }
9168
9236
  var _proto = ModelPlugin.prototype;
9169
- _proto.processAssets = function processAssets(scene, options) {
9237
+ _proto.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
9170
9238
  return _async_to_generator(function() {
9171
9239
  return __generator(this, function(_state) {
9172
9240
  switch(_state.label){
@@ -9188,7 +9256,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
9188
9256
  * 整个 load 阶段都不会创建 GL 相关的对象,只创建 JS 对象
9189
9257
  * @param scene - 场景
9190
9258
  * @param options - 加载选项
9191
- */ _proto.prepareResource = function prepareResource(scene, options, engine) {
9259
+ */ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {
9192
9260
  var _options_pluginData;
9193
9261
  if (options.pluginData !== undefined) {
9194
9262
  var keyList = [
@@ -9242,7 +9310,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
9242
9310
  * 创建 3D 场景管理器和缓存器
9243
9311
  * @param composition - 合成
9244
9312
  * @param scene - 场景
9245
- */ _proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {
9313
+ */ _proto.onCompositionCreated = function onCompositionCreated(composition, scene) {
9246
9314
  var props = {
9247
9315
  id: "ModelPluginItem",
9248
9316
  name: "ModelPluginItem",
@@ -9255,7 +9323,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
9255
9323
  modelPluginComponent.sceneParams = scene.storage;
9256
9324
  };
9257
9325
  return ModelPlugin;
9258
- }(AbstractPlugin);
9326
+ }(_wrap_native_super(Plugin));
9259
9327
  var ModelPluginComponent = /*#__PURE__*/ function(Behaviour) {
9260
9328
  _inherits(ModelPluginComponent, Behaviour);
9261
9329
  function ModelPluginComponent(engine) {
@@ -13106,7 +13174,7 @@ var GLTFHelper = /*#__PURE__*/ function() {
13106
13174
  registerPlugin("model", ModelPlugin);
13107
13175
  /**
13108
13176
  * 插件版本号
13109
- */ var version = "2.8.0-alpha.3";
13177
+ */ var version = "2.8.0-alpha.4";
13110
13178
  logger.info("Plugin model version: " + version + ".");
13111
13179
  if (version !== EFFECTS.version) {
13112
13180
  console.error("注意:请统一 Model 插件与 Player 版本,不统一的版本混用会有不可预知的后果!", "\nAttention: Please ensure the Model plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");