@galacean/effects-plugin-editor-gizmo 2.6.5 → 2.7.0-alpha.0
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 +11 -40
- 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 +11 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects player editor gizmo plugin
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 茂安,旻诺
|
|
6
|
-
* Version: v2.
|
|
6
|
+
* Version: v2.7.0-alpha.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -271,9 +271,6 @@ function destroyWireframeMesh(mesh) {
|
|
|
271
271
|
var _mesh_geometry;
|
|
272
272
|
(_mesh_geometry = mesh.geometry) == null ? void 0 : _mesh_geometry.dispose();
|
|
273
273
|
mesh.dispose({
|
|
274
|
-
material: {
|
|
275
|
-
textures: EFFECTS.DestroyOptions.keep
|
|
276
|
-
},
|
|
277
274
|
geometries: EFFECTS.DestroyOptions.keep
|
|
278
275
|
});
|
|
279
276
|
}
|
|
@@ -425,7 +422,7 @@ var SharedGeometry = /*#__PURE__*/ function(GLGeometry) {
|
|
|
425
422
|
//this.vaos = this._source.vaos;
|
|
426
423
|
//创建ibo
|
|
427
424
|
if (this.indices) {
|
|
428
|
-
this.indicesBuffer = this.createIndicesBuffer(this.
|
|
425
|
+
this.indicesBuffer = this.createIndicesBuffer(this.indices);
|
|
429
426
|
}
|
|
430
427
|
this.flush();
|
|
431
428
|
this.initialized = true;
|
|
@@ -1954,15 +1951,9 @@ var Vector2$1 = EFFECTS.math.Vector2, Vector3$3 = EFFECTS.math.Vector3, Matrix4$
|
|
|
1954
1951
|
1
|
|
1955
1952
|
])
|
|
1956
1953
|
},
|
|
1957
|
-
uniformSemantics: {
|
|
1958
|
-
u_viewinverse: "VIEWINVERSE",
|
|
1959
|
-
u_v: "VIEW",
|
|
1960
|
-
u_p: "PROJECTION",
|
|
1961
|
-
u_et: "EDITOR_TRANSFORM"
|
|
1962
|
-
},
|
|
1963
1954
|
shader: {
|
|
1964
1955
|
fragment: "\n precision mediump float;\n\n uniform vec3 u_color;\n\n void main(){\n gl_FragColor = vec4(u_color,1.0);\n }",
|
|
1965
|
-
vertex: "\n precision highp float;\n\n attribute vec3 a_Position;\n\n uniform mat4 u_model;\n uniform mat4 effects_MatrixV;\n uniform mat4 _MatrixP;\n
|
|
1956
|
+
vertex: "\n precision highp float;\n\n attribute vec3 a_Position;\n\n uniform mat4 u_model;\n uniform mat4 effects_MatrixV;\n uniform mat4 _MatrixP;\n\n void main(){\n gl_Position = _MatrixP * effects_MatrixV * u_model * vec4(a_Position,1.0);\n }",
|
|
1966
1957
|
shared: true
|
|
1967
1958
|
}
|
|
1968
1959
|
});
|
|
@@ -2015,15 +2006,9 @@ var Vector2$1 = EFFECTS.math.Vector2, Vector3$3 = EFFECTS.math.Vector3, Matrix4$
|
|
|
2015
2006
|
0
|
|
2016
2007
|
])
|
|
2017
2008
|
},
|
|
2018
|
-
uniformSemantics: {
|
|
2019
|
-
u_viewinverse: "VIEWINVERSE",
|
|
2020
|
-
u_v: "VIEW",
|
|
2021
|
-
u_p: "PROJECTION",
|
|
2022
|
-
u_et: "EDITOR_TRANSFORM"
|
|
2023
|
-
},
|
|
2024
2009
|
shader: {
|
|
2025
2010
|
fragment: "\n precision mediump float;\n\n uniform vec3 u_color;\n\n varying float flag;\n\n void main(){\n if(flag > 0.0) {\n discard;\n }\n\n gl_FragColor = vec4(u_color,1.0);\n }",
|
|
2026
|
-
vertex: "\n precision highp float;\n\n attribute vec3 a_Position;\n\n uniform mat4 u_model;\n uniform mat4 effects_MatrixV;\n uniform mat4 _MatrixP;\n
|
|
2011
|
+
vertex: "\n precision highp float;\n\n attribute vec3 a_Position;\n\n uniform mat4 u_model;\n uniform mat4 effects_MatrixV;\n uniform mat4 _MatrixP;\n\n uniform vec3 u_cameraPos;\n uniform vec3 u_center;\n\n varying float flag;\n void main(){\n float distance = length(u_cameraPos - u_center);\n vec3 worldPosition = (u_model * vec4(a_Position,1.0)).xyz;\n flag = length(u_cameraPos - worldPosition) - distance;\n gl_Position = _MatrixP * effects_MatrixV * u_model * vec4(a_Position,1.0);\n }",
|
|
2027
2012
|
shared: true
|
|
2028
2013
|
}
|
|
2029
2014
|
});
|
|
@@ -2074,16 +2059,10 @@ var Vector2$1 = EFFECTS.math.Vector2, Vector3$3 = EFFECTS.math.Vector3, Matrix4$
|
|
|
2074
2059
|
1
|
|
2075
2060
|
])
|
|
2076
2061
|
},
|
|
2077
|
-
uniformSemantics: {
|
|
2078
|
-
u_viewinverse: "VIEWINVERSE",
|
|
2079
|
-
u_v: "VIEW",
|
|
2080
|
-
u_p: "PROJECTION",
|
|
2081
|
-
u_et: "EDITOR_TRANSFORM"
|
|
2082
|
-
},
|
|
2083
2062
|
shader: {
|
|
2084
2063
|
shared: true,
|
|
2085
2064
|
fragment: "\n precision mediump float;\n\n uniform vec3 u_color;\n uniform vec2 u_alpha;\n\n void main(){\n gl_FragColor = vec4(u_color,u_alpha);\n }",
|
|
2086
|
-
vertex: "\n precision highp float;\n\n attribute vec3 a_Position;\n\n uniform mat4 u_model;\n uniform mat4 effects_MatrixV;\n uniform mat4 _MatrixP;\n
|
|
2065
|
+
vertex: "\n precision highp float;\n\n attribute vec3 a_Position;\n\n uniform mat4 u_model;\n uniform mat4 effects_MatrixV;\n uniform mat4 _MatrixP;\n void main(){\n gl_Position = _MatrixP * effects_MatrixV * u_model * vec4(a_Position,1.0);\n }"
|
|
2087
2066
|
}
|
|
2088
2067
|
});
|
|
2089
2068
|
material.setVector3("u_color", myColor);
|
|
@@ -2133,16 +2112,10 @@ function createSpriteMaterial(engine, data, depthTest) {
|
|
|
2133
2112
|
};
|
|
2134
2113
|
var material = EFFECTS.Material.create(engine, {
|
|
2135
2114
|
uniformValues: uniformValues,
|
|
2136
|
-
uniformSemantics: {
|
|
2137
|
-
u_viewinverse: "VIEWINVERSE",
|
|
2138
|
-
u_v: "VIEW",
|
|
2139
|
-
u_p: "PROJECTION",
|
|
2140
|
-
u_et: "EDITOR_TRANSFORM"
|
|
2141
|
-
},
|
|
2142
2115
|
shader: {
|
|
2143
2116
|
shared: true,
|
|
2144
2117
|
fragment: "\n precision highp float;\n\n uniform vec2 u_alpha;\n uniform vec3 u_color;\n uniform sampler2D u_iconTex;\n\n varying vec2 v_uv;\n\n void main(){\n vec4 color = texture2D(u_iconTex, vec2(v_uv.x, 1.0 - v_uv.y));\n if(color.a < 0.001)\n {\n discard;\n }\n gl_FragColor = vec4(color.xyz, color.w * u_alpha.x);\n }",
|
|
2145
|
-
vertex: "\n precision highp float;\n\n attribute vec3 a_Position;\n attribute vec2 a_UV1;\n\n uniform mat4 u_model;\n uniform mat4 effects_MatrixV;\n uniform mat4 _MatrixP;\n uniform mat4 effects_MatrixInvV;\n
|
|
2118
|
+
vertex: "\n precision highp float;\n\n attribute vec3 a_Position;\n attribute vec2 a_UV1;\n\n uniform mat4 u_model;\n uniform mat4 effects_MatrixV;\n uniform mat4 _MatrixP;\n uniform mat4 effects_MatrixInvV;\n varying vec2 v_uv;\n\n void main(){\n v_uv = a_UV1;\n vec4 pos = u_model * vec4(0., 0., 0., 1.0);\n // vec4 pos = u_model * vec4(a_Position,1.0);\n\n pos.xyz += effects_MatrixInvV[0].xyz * a_Position.x + effects_MatrixInvV[1].xyz * a_Position.y;\n gl_Position = _MatrixP * effects_MatrixV * pos;\n }"
|
|
2146
2119
|
}
|
|
2147
2120
|
});
|
|
2148
2121
|
material.setMatrix("u_model", Matrix4$3.IDENTITY);
|
|
@@ -2779,14 +2752,10 @@ function createMesh(engine, points, indices, color, depthTest, name) {
|
|
|
2779
2752
|
1
|
|
2780
2753
|
])
|
|
2781
2754
|
},
|
|
2782
|
-
uniformSemantics: {
|
|
2783
|
-
u_vp: "VIEWPROJECTION",
|
|
2784
|
-
u_et: "EDITOR_TRANSFORM"
|
|
2785
|
-
},
|
|
2786
2755
|
shader: {
|
|
2787
2756
|
shared: true,
|
|
2788
2757
|
fragment: "\n precision mediump float;\n\n uniform vec3 u_color;\n\n void main(){\n gl_FragColor = vec4(u_color,1.0);\n }",
|
|
2789
|
-
vertex: "precision highp float;\n\n attribute vec3 a_Position;\n\n uniform mat4 u_model;\n uniform mat4 effects_MatrixVP;\n
|
|
2758
|
+
vertex: "precision highp float;\n\n attribute vec3 a_Position;\n\n uniform mat4 u_model;\n uniform mat4 effects_MatrixVP;\n void main(){\n gl_Position = effects_MatrixVP * u_model * vec4(a_Position,1.0);\n }"
|
|
2790
2759
|
}
|
|
2791
2760
|
});
|
|
2792
2761
|
material.setVector3("u_color", Vector3$1.fromArray(color));
|
|
@@ -3106,9 +3075,11 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3106
3075
|
if (this.wireframeMesh && this.targetItem) {
|
|
3107
3076
|
var _this_targetItem_getComponent;
|
|
3108
3077
|
//@ts-expect-error TODO 和 3D 类型解耦
|
|
3109
|
-
var
|
|
3078
|
+
var pMesh = (_this_targetItem_getComponent = this.targetItem.getComponent(EFFECTS.RendererComponent)) == null ? void 0 : _this_targetItem_getComponent.content;
|
|
3079
|
+
var meshes = pMesh.subMeshes;
|
|
3110
3080
|
var wireframeMeshes = this.wireframeMeshes;
|
|
3111
3081
|
if ((meshes == null ? void 0 : meshes.length) > 0) {
|
|
3082
|
+
wireframeMeshes[0].worldMatrix.copyFrom(pMesh.matrix);
|
|
3112
3083
|
updateWireframeMesh(meshes[0].geometry.geometry, meshes[0].material.effectMaterial, wireframeMeshes[0], WireframeGeometryType.triangle);
|
|
3113
3084
|
}
|
|
3114
3085
|
}
|
|
@@ -3709,7 +3680,7 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
3709
3680
|
EFFECTS.registerPlugin("editor-gizmo", EditorGizmoPlugin, EFFECTS.VFXItem);
|
|
3710
3681
|
/**
|
|
3711
3682
|
* 插件版本号
|
|
3712
|
-
*/ var version = "2.
|
|
3683
|
+
*/ var version = "2.7.0-alpha.0";
|
|
3713
3684
|
EFFECTS.logger.info("Plugin editor gizmo version: " + version + ".");
|
|
3714
3685
|
if (version !== EFFECTS__namespace.version) {
|
|
3715
3686
|
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!");
|