@galacean/effects-plugin-editor-gizmo 2.8.0-alpha.0 → 2.8.0-alpha.2
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/gizmo-loader.d.ts +1 -3
- package/dist/index.js +87 -47
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +88 -48
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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.8.0-alpha.
|
|
6
|
+
* Version: v2.8.0-alpha.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as EFFECTS from '@galacean/effects';
|
|
10
|
-
import { glContext, Texture, noop, math, Geometry, Transform, Mesh, Material, DestroyOptions, GLSLVersion, GLGeometry, serialize, effectsClass, RendererComponent, ParticleSystemRenderer, assertExist,
|
|
10
|
+
import { glContext, Texture, noop, math, Geometry, Transform, Mesh, Material, DestroyOptions, GLSLVersion, GLGeometry, serialize, effectsClass, PluginSystem, RendererComponent, ParticleSystemRenderer, assertExist, TextureLoadAction, HitTestType, spec, RenderPassPriorityPostprocess, RenderPass, RenderPassPriorityPrepare, AbstractPlugin, registerPlugin, logger } from '@galacean/effects';
|
|
11
11
|
|
|
12
12
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
13
13
|
try {
|
|
@@ -2995,8 +2995,8 @@ var GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
2995
2995
|
return;
|
|
2996
2996
|
}
|
|
2997
2997
|
var composition = this.item.composition;
|
|
2998
|
-
var
|
|
2999
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose((
|
|
2998
|
+
var _PluginSystem_getPlugins;
|
|
2999
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose((_PluginSystem_getPlugins = PluginSystem.getPlugins()) != null ? _PluginSystem_getPlugins : []), _step1; !(_step1 = _iterator1()).done;){
|
|
3000
3000
|
var plugin = _step1.value;
|
|
3001
3001
|
if (plugin.name === "editor-gizmo") {
|
|
3002
3002
|
this.gizmoPlugin = plugin;
|
|
@@ -3462,13 +3462,7 @@ var GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3462
3462
|
return renderPass.name === behindRenderPassName;
|
|
3463
3463
|
});
|
|
3464
3464
|
if (!rp) {
|
|
3465
|
-
rp = new
|
|
3466
|
-
name: behindRenderPassName,
|
|
3467
|
-
priority: RenderPassPriorityPostprocess + RenderPassPriorityPostprocess,
|
|
3468
|
-
clearAction: {
|
|
3469
|
-
depthAction: TextureLoadAction.clear
|
|
3470
|
-
}
|
|
3471
|
-
});
|
|
3465
|
+
rp = new DrawGizmoBehindPass(pipeline.renderer);
|
|
3472
3466
|
pipeline.addRenderPass(rp);
|
|
3473
3467
|
}
|
|
3474
3468
|
return rp;
|
|
@@ -3478,10 +3472,7 @@ var GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3478
3472
|
return renderPass.name === editorRenderPassName;
|
|
3479
3473
|
});
|
|
3480
3474
|
if (!rp) {
|
|
3481
|
-
rp = new
|
|
3482
|
-
name: editorRenderPassName,
|
|
3483
|
-
priority: RenderPassPriorityPostprocess + 2
|
|
3484
|
-
});
|
|
3475
|
+
rp = new DrawGizmoEditorPass(pipeline.renderer);
|
|
3485
3476
|
pipeline.addRenderPass(rp);
|
|
3486
3477
|
}
|
|
3487
3478
|
return rp;
|
|
@@ -3491,10 +3482,7 @@ var GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3491
3482
|
return renderPass.name === frontRenderPassName;
|
|
3492
3483
|
});
|
|
3493
3484
|
if (!rp) {
|
|
3494
|
-
rp = new
|
|
3495
|
-
name: frontRenderPassName,
|
|
3496
|
-
priority: RenderPassPriorityPrepare + 2
|
|
3497
|
-
});
|
|
3485
|
+
rp = new DrawGizmoFrontPass(pipeline.renderer);
|
|
3498
3486
|
pipeline.addRenderPass(rp);
|
|
3499
3487
|
}
|
|
3500
3488
|
return rp;
|
|
@@ -3512,6 +3500,63 @@ var CoordinateSpace;
|
|
|
3512
3500
|
CoordinateSpace[CoordinateSpace["Local"] = 0] = "Local";
|
|
3513
3501
|
CoordinateSpace[CoordinateSpace["World"] = 1] = "World";
|
|
3514
3502
|
})(CoordinateSpace || (CoordinateSpace = {}));
|
|
3503
|
+
var DrawGizmoBehindPass = /*#__PURE__*/ function(RenderPass) {
|
|
3504
|
+
_inherits(DrawGizmoBehindPass, RenderPass);
|
|
3505
|
+
function DrawGizmoBehindPass(renderer) {
|
|
3506
|
+
var _this;
|
|
3507
|
+
_this = RenderPass.call(this, renderer) || this;
|
|
3508
|
+
_this.priority = RenderPassPriorityPostprocess + RenderPassPriorityPostprocess;
|
|
3509
|
+
_this.name = behindRenderPassName;
|
|
3510
|
+
return _this;
|
|
3511
|
+
}
|
|
3512
|
+
var _proto = DrawGizmoBehindPass.prototype;
|
|
3513
|
+
_proto.execute = function execute(renderer) {
|
|
3514
|
+
renderer.clear({
|
|
3515
|
+
depthAction: TextureLoadAction.clear
|
|
3516
|
+
});
|
|
3517
|
+
renderer.renderMeshes(this.meshes);
|
|
3518
|
+
};
|
|
3519
|
+
_proto.configure = function configure(renderer) {
|
|
3520
|
+
renderer.setFramebuffer(this.framebuffer);
|
|
3521
|
+
};
|
|
3522
|
+
return DrawGizmoBehindPass;
|
|
3523
|
+
}(RenderPass);
|
|
3524
|
+
var DrawGizmoFrontPass = /*#__PURE__*/ function(RenderPass) {
|
|
3525
|
+
_inherits(DrawGizmoFrontPass, RenderPass);
|
|
3526
|
+
function DrawGizmoFrontPass(renderer) {
|
|
3527
|
+
var _this;
|
|
3528
|
+
_this = RenderPass.call(this, renderer) || this;
|
|
3529
|
+
_this.priority = RenderPassPriorityPrepare + 2;
|
|
3530
|
+
_this.name = frontRenderPassName;
|
|
3531
|
+
return _this;
|
|
3532
|
+
}
|
|
3533
|
+
var _proto = DrawGizmoFrontPass.prototype;
|
|
3534
|
+
_proto.execute = function execute(renderer) {
|
|
3535
|
+
renderer.renderMeshes(this.meshes);
|
|
3536
|
+
};
|
|
3537
|
+
_proto.configure = function configure(renderer) {
|
|
3538
|
+
renderer.setFramebuffer(this.framebuffer);
|
|
3539
|
+
};
|
|
3540
|
+
return DrawGizmoFrontPass;
|
|
3541
|
+
}(RenderPass);
|
|
3542
|
+
var DrawGizmoEditorPass = /*#__PURE__*/ function(RenderPass) {
|
|
3543
|
+
_inherits(DrawGizmoEditorPass, RenderPass);
|
|
3544
|
+
function DrawGizmoEditorPass(renderer) {
|
|
3545
|
+
var _this;
|
|
3546
|
+
_this = RenderPass.call(this, renderer) || this;
|
|
3547
|
+
_this.priority = RenderPassPriorityPostprocess + 2;
|
|
3548
|
+
_this.name = editorRenderPassName;
|
|
3549
|
+
return _this;
|
|
3550
|
+
}
|
|
3551
|
+
var _proto = DrawGizmoEditorPass.prototype;
|
|
3552
|
+
_proto.execute = function execute(renderer) {
|
|
3553
|
+
renderer.renderMeshes(this.meshes);
|
|
3554
|
+
};
|
|
3555
|
+
_proto.configure = function configure(renderer) {
|
|
3556
|
+
renderer.setFramebuffer(this.framebuffer);
|
|
3557
|
+
};
|
|
3558
|
+
return DrawGizmoEditorPass;
|
|
3559
|
+
}(RenderPass);
|
|
3515
3560
|
|
|
3516
3561
|
var iconImages = new Map();
|
|
3517
3562
|
var iconTextures = new Map();
|
|
@@ -3525,35 +3570,13 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
3525
3570
|
}
|
|
3526
3571
|
var _proto = EditorGizmoPlugin.prototype;
|
|
3527
3572
|
_proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {
|
|
3528
|
-
var engine = composition.renderer.engine;
|
|
3529
|
-
iconTextures.clear();
|
|
3530
|
-
iconImages.forEach(function(image, name) {
|
|
3531
|
-
iconTextures.set(name, createTexture(engine, image));
|
|
3532
|
-
});
|
|
3533
|
-
iconImages.clear();
|
|
3534
|
-
};
|
|
3535
|
-
_proto.onCompositionReset = function onCompositionReset(composition) {
|
|
3536
|
-
var items = composition.items;
|
|
3537
|
-
var targetMap = {};
|
|
3538
|
-
for(var i = 0; i < items.length; i++){
|
|
3539
|
-
var item = items[i];
|
|
3540
|
-
var gizmoComponent = item.getComponent(GizmoComponent);
|
|
3541
|
-
if (gizmoComponent) {
|
|
3542
|
-
if (!targetMap[gizmoComponent.target]) {
|
|
3543
|
-
targetMap[gizmoComponent.target] = [];
|
|
3544
|
-
}
|
|
3545
|
-
targetMap[gizmoComponent.target].push(item);
|
|
3546
|
-
}
|
|
3547
|
-
}
|
|
3548
|
-
composition.loaderData.gizmoTarget = targetMap;
|
|
3549
|
-
composition.loaderData.gizmoItems = [];
|
|
3550
|
-
};
|
|
3551
|
-
EditorGizmoPlugin.prepareResource = function prepareResource(scene) {
|
|
3552
3573
|
return _async_to_generator(function() {
|
|
3553
|
-
var _iterator, _step, _step_value, name, data, _, _tmp;
|
|
3574
|
+
var engine, _iterator, _step, _step_value, name, data, _, _tmp, items, targetMap, i, item, gizmoComponent;
|
|
3554
3575
|
return __generator(this, function(_state) {
|
|
3555
3576
|
switch(_state.label){
|
|
3556
3577
|
case 0:
|
|
3578
|
+
engine = composition.renderer.engine;
|
|
3579
|
+
iconTextures.clear();
|
|
3557
3580
|
if (!(iconImages.size !== axisIconMap.size)) return [
|
|
3558
3581
|
3,
|
|
3559
3582
|
4
|
|
@@ -3585,9 +3608,26 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
3585
3608
|
1
|
|
3586
3609
|
];
|
|
3587
3610
|
case 4:
|
|
3611
|
+
iconImages.forEach(function(image, name) {
|
|
3612
|
+
iconTextures.set(name, createTexture(engine, image));
|
|
3613
|
+
});
|
|
3614
|
+
iconImages.clear();
|
|
3615
|
+
items = composition.items;
|
|
3616
|
+
targetMap = {};
|
|
3617
|
+
for(i = 0; i < items.length; i++){
|
|
3618
|
+
item = items[i];
|
|
3619
|
+
gizmoComponent = item.getComponent(GizmoComponent);
|
|
3620
|
+
if (gizmoComponent) {
|
|
3621
|
+
if (!targetMap[gizmoComponent.target]) {
|
|
3622
|
+
targetMap[gizmoComponent.target] = [];
|
|
3623
|
+
}
|
|
3624
|
+
targetMap[gizmoComponent.target].push(item);
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
composition.loaderData.gizmoTarget = targetMap;
|
|
3628
|
+
composition.loaderData.gizmoItems = [];
|
|
3588
3629
|
return [
|
|
3589
|
-
2
|
|
3590
|
-
true
|
|
3630
|
+
2
|
|
3591
3631
|
];
|
|
3592
3632
|
}
|
|
3593
3633
|
});
|
|
@@ -3596,10 +3636,10 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
3596
3636
|
return EditorGizmoPlugin;
|
|
3597
3637
|
}(AbstractPlugin);
|
|
3598
3638
|
|
|
3599
|
-
registerPlugin("editor-gizmo", EditorGizmoPlugin
|
|
3639
|
+
registerPlugin("editor-gizmo", EditorGizmoPlugin);
|
|
3600
3640
|
/**
|
|
3601
3641
|
* 插件版本号
|
|
3602
|
-
*/ var version = "2.8.0-alpha.
|
|
3642
|
+
*/ var version = "2.8.0-alpha.2";
|
|
3603
3643
|
logger.info("Plugin editor gizmo version: " + version + ".");
|
|
3604
3644
|
if (version !== EFFECTS.version) {
|
|
3605
3645
|
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!");
|