@galacean/effects-plugin-editor-gizmo 2.0.0-alpha.32 → 2.0.0-alpha.34

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 editor gizmo plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 茂安,旻诺
6
- * Version: v2.0.0-alpha.32
6
+ * Version: v2.0.0-alpha.34
7
7
  */
8
8
 
9
9
  import * as EFFECTS from '@galacean/effects';
10
- import { math, DestroyOptions, glContext, ShaderType, GLSLVersion, Material, Mesh, GLGeometry, createShaderWithMacros, Texture, noop, Geometry, Transform, serialize, effectsClass, RendererComponent, ParticleSystemRenderer, assertExist, HitTestType, spec, removeItem, RenderPass, RenderPassPriorityPostprocess, TextureLoadAction, RenderPassPriorityPrepare, AbstractPlugin, registerPlugin, VFXItem, logger } from '@galacean/effects';
10
+ import { math, DestroyOptions, glContext, GLSLVersion, Material, Mesh, GLGeometry, Texture, noop, Geometry, Transform, serialize, effectsClass, RendererComponent, ParticleSystemRenderer, assertExist, HitTestType, spec, removeItem, RenderPass, RenderPassPriorityPostprocess, TextureLoadAction, RenderPassPriorityPrepare, AbstractPlugin, registerPlugin, VFXItem, logger } from '@galacean/effects';
11
11
 
12
12
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
13
13
  try {
@@ -303,7 +303,6 @@ function getQuadIndexData(faceCount, oid) {
303
303
  return indexData;
304
304
  }
305
305
  function createModeWireframe(engine, mesh, color) {
306
- var level = engine.gpuCapability.level;
307
306
  var geometry = new SharedGeometry(engine, {
308
307
  geometry: mesh.firstGeometry(),
309
308
  mode: glContext.LINES,
@@ -321,8 +320,9 @@ function createModeWireframe(engine, mesh, color) {
321
320
  ];
322
321
  var _mesh_name;
323
322
  materialOptions.shader = {
324
- vertex: createGizmoShader(newMacros, vertex, ShaderType.vertex, level),
325
- fragment: createGizmoShader(newMacros, fragment, ShaderType.fragment, level),
323
+ vertex: vertex,
324
+ fragment: fragment,
325
+ macros: newMacros,
326
326
  shared: true,
327
327
  name: ((_mesh_name = mesh.name) != null ? _mesh_name : "unamedmesh") + "_wireframe",
328
328
  glslVersion: engine.gpuCapability.level === 2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1
@@ -429,12 +429,6 @@ var SharedGeometry = /*#__PURE__*/ function(GLGeometry) {
429
429
  };
430
430
  return SharedGeometry;
431
431
  }(GLGeometry);
432
- function createGizmoShader(macros, shader, shaderType, level) {
433
- var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
434
- var shaderMatch = shader.match(versionTag);
435
- var newShader = shaderMatch ? shader.substring(shaderMatch[0].length) : shader;
436
- return createShaderWithMacros(macros, newShader, shaderType, level);
437
- }
438
432
 
439
433
  // 坐标轴默认颜色
440
434
  var color = {
@@ -3018,8 +3012,10 @@ var GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3018
3012
  }
3019
3013
  var _proto = GizmoComponent.prototype;
3020
3014
  _proto.start = function start() {
3015
+ var _this_item_composition;
3021
3016
  this.item.getHitTestParams = this.getHitTestParams;
3022
- for(var _iterator = _create_for_of_iterator_helper_loose(this.item.composition.items), _step; !(_step = _iterator()).done;){
3017
+ var _this_item_composition_items;
3018
+ for(var _iterator = _create_for_of_iterator_helper_loose((_this_item_composition_items = (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.items) != null ? _this_item_composition_items : []), _step; !(_step = _iterator()).done;){
3023
3019
  var item = _step.value;
3024
3020
  if (item.id === this.target) {
3025
3021
  this.targetItem = item;
@@ -3030,7 +3026,8 @@ var GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3030
3026
  return;
3031
3027
  }
3032
3028
  var composition = this.item.composition;
3033
- for(var _iterator1 = _create_for_of_iterator_helper_loose(composition.pluginSystem.plugins), _step1; !(_step1 = _iterator1()).done;){
3029
+ var _composition_pluginSystem_plugins;
3030
+ for(var _iterator1 = _create_for_of_iterator_helper_loose((_composition_pluginSystem_plugins = composition == null ? void 0 : composition.pluginSystem.plugins) != null ? _composition_pluginSystem_plugins : []), _step1; !(_step1 = _iterator1()).done;){
3034
3031
  var plugin = _step1.value;
3035
3032
  if (plugin.name === "editor-gizmo") {
3036
3033
  this.gizmoPlugin = plugin;
@@ -3079,7 +3076,7 @@ var GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3079
3076
  this.createBoundingBoxContent(targetItem, gizmoPlugin.meshToAdd);
3080
3077
  break;
3081
3078
  }
3082
- composition.loaderData.gizmoItems.push(this.item);
3079
+ composition == null ? void 0 : composition.loaderData.gizmoItems.push(this.item);
3083
3080
  };
3084
3081
  _proto.update = function update(dt) {
3085
3082
  this.updateRenderData();
@@ -3693,7 +3690,7 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3693
3690
  }(AbstractPlugin);
3694
3691
 
3695
3692
  registerPlugin("editor-gizmo", EditorGizmoPlugin, VFXItem);
3696
- var version = "2.0.0-alpha.32";
3693
+ var version = "2.0.0-alpha.34";
3697
3694
  logger.info("Plugin editor gizmo version: " + version + ".");
3698
3695
  if (version !== EFFECTS.version) {
3699
3696
  console.error("注意:请统一 Editor Gizmo 插件与 Player 版本,不统一的版本混用会有不可预知的后果!", "\nAttention: Please ensure the Editor Gizmo plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");