@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.mjs
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
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -248,9 +248,6 @@ function destroyWireframeMesh(mesh) {
|
|
|
248
248
|
var _mesh_geometry;
|
|
249
249
|
(_mesh_geometry = mesh.geometry) == null ? void 0 : _mesh_geometry.dispose();
|
|
250
250
|
mesh.dispose({
|
|
251
|
-
material: {
|
|
252
|
-
textures: DestroyOptions.keep
|
|
253
|
-
},
|
|
254
251
|
geometries: DestroyOptions.keep
|
|
255
252
|
});
|
|
256
253
|
}
|
|
@@ -402,7 +399,7 @@ var SharedGeometry = /*#__PURE__*/ function(GLGeometry) {
|
|
|
402
399
|
//this.vaos = this._source.vaos;
|
|
403
400
|
//创建ibo
|
|
404
401
|
if (this.indices) {
|
|
405
|
-
this.indicesBuffer = this.createIndicesBuffer(this.
|
|
402
|
+
this.indicesBuffer = this.createIndicesBuffer(this.indices);
|
|
406
403
|
}
|
|
407
404
|
this.flush();
|
|
408
405
|
this.initialized = true;
|
|
@@ -1931,15 +1928,9 @@ var Vector2$1 = math.Vector2, Vector3$3 = math.Vector3, Matrix4$3 = math.Matrix4
|
|
|
1931
1928
|
1
|
|
1932
1929
|
])
|
|
1933
1930
|
},
|
|
1934
|
-
uniformSemantics: {
|
|
1935
|
-
u_viewinverse: "VIEWINVERSE",
|
|
1936
|
-
u_v: "VIEW",
|
|
1937
|
-
u_p: "PROJECTION",
|
|
1938
|
-
u_et: "EDITOR_TRANSFORM"
|
|
1939
|
-
},
|
|
1940
1931
|
shader: {
|
|
1941
1932
|
fragment: "\n precision mediump float;\n\n uniform vec3 u_color;\n\n void main(){\n gl_FragColor = vec4(u_color,1.0);\n }",
|
|
1942
|
-
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
|
|
1933
|
+
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 }",
|
|
1943
1934
|
shared: true
|
|
1944
1935
|
}
|
|
1945
1936
|
});
|
|
@@ -1992,15 +1983,9 @@ var Vector2$1 = math.Vector2, Vector3$3 = math.Vector3, Matrix4$3 = math.Matrix4
|
|
|
1992
1983
|
0
|
|
1993
1984
|
])
|
|
1994
1985
|
},
|
|
1995
|
-
uniformSemantics: {
|
|
1996
|
-
u_viewinverse: "VIEWINVERSE",
|
|
1997
|
-
u_v: "VIEW",
|
|
1998
|
-
u_p: "PROJECTION",
|
|
1999
|
-
u_et: "EDITOR_TRANSFORM"
|
|
2000
|
-
},
|
|
2001
1986
|
shader: {
|
|
2002
1987
|
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 }",
|
|
2003
|
-
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
|
|
1988
|
+
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 }",
|
|
2004
1989
|
shared: true
|
|
2005
1990
|
}
|
|
2006
1991
|
});
|
|
@@ -2051,16 +2036,10 @@ var Vector2$1 = math.Vector2, Vector3$3 = math.Vector3, Matrix4$3 = math.Matrix4
|
|
|
2051
2036
|
1
|
|
2052
2037
|
])
|
|
2053
2038
|
},
|
|
2054
|
-
uniformSemantics: {
|
|
2055
|
-
u_viewinverse: "VIEWINVERSE",
|
|
2056
|
-
u_v: "VIEW",
|
|
2057
|
-
u_p: "PROJECTION",
|
|
2058
|
-
u_et: "EDITOR_TRANSFORM"
|
|
2059
|
-
},
|
|
2060
2039
|
shader: {
|
|
2061
2040
|
shared: true,
|
|
2062
2041
|
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 }",
|
|
2063
|
-
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
|
|
2042
|
+
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 }"
|
|
2064
2043
|
}
|
|
2065
2044
|
});
|
|
2066
2045
|
material.setVector3("u_color", myColor);
|
|
@@ -2110,16 +2089,10 @@ function createSpriteMaterial(engine, data, depthTest) {
|
|
|
2110
2089
|
};
|
|
2111
2090
|
var material = Material.create(engine, {
|
|
2112
2091
|
uniformValues: uniformValues,
|
|
2113
|
-
uniformSemantics: {
|
|
2114
|
-
u_viewinverse: "VIEWINVERSE",
|
|
2115
|
-
u_v: "VIEW",
|
|
2116
|
-
u_p: "PROJECTION",
|
|
2117
|
-
u_et: "EDITOR_TRANSFORM"
|
|
2118
|
-
},
|
|
2119
2092
|
shader: {
|
|
2120
2093
|
shared: true,
|
|
2121
2094
|
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 }",
|
|
2122
|
-
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
|
|
2095
|
+
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 }"
|
|
2123
2096
|
}
|
|
2124
2097
|
});
|
|
2125
2098
|
material.setMatrix("u_model", Matrix4$3.IDENTITY);
|
|
@@ -2756,14 +2729,10 @@ function createMesh(engine, points, indices, color, depthTest, name) {
|
|
|
2756
2729
|
1
|
|
2757
2730
|
])
|
|
2758
2731
|
},
|
|
2759
|
-
uniformSemantics: {
|
|
2760
|
-
u_vp: "VIEWPROJECTION",
|
|
2761
|
-
u_et: "EDITOR_TRANSFORM"
|
|
2762
|
-
},
|
|
2763
2732
|
shader: {
|
|
2764
2733
|
shared: true,
|
|
2765
2734
|
fragment: "\n precision mediump float;\n\n uniform vec3 u_color;\n\n void main(){\n gl_FragColor = vec4(u_color,1.0);\n }",
|
|
2766
|
-
vertex: "precision highp float;\n\n attribute vec3 a_Position;\n\n uniform mat4 u_model;\n uniform mat4 effects_MatrixVP;\n
|
|
2735
|
+
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 }"
|
|
2767
2736
|
}
|
|
2768
2737
|
});
|
|
2769
2738
|
material.setVector3("u_color", Vector3$1.fromArray(color));
|
|
@@ -3083,9 +3052,11 @@ var GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3083
3052
|
if (this.wireframeMesh && this.targetItem) {
|
|
3084
3053
|
var _this_targetItem_getComponent;
|
|
3085
3054
|
//@ts-expect-error TODO 和 3D 类型解耦
|
|
3086
|
-
var
|
|
3055
|
+
var pMesh = (_this_targetItem_getComponent = this.targetItem.getComponent(RendererComponent)) == null ? void 0 : _this_targetItem_getComponent.content;
|
|
3056
|
+
var meshes = pMesh.subMeshes;
|
|
3087
3057
|
var wireframeMeshes = this.wireframeMeshes;
|
|
3088
3058
|
if ((meshes == null ? void 0 : meshes.length) > 0) {
|
|
3059
|
+
wireframeMeshes[0].worldMatrix.copyFrom(pMesh.matrix);
|
|
3089
3060
|
updateWireframeMesh(meshes[0].geometry.geometry, meshes[0].material.effectMaterial, wireframeMeshes[0], WireframeGeometryType.triangle);
|
|
3090
3061
|
}
|
|
3091
3062
|
}
|
|
@@ -3686,7 +3657,7 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
3686
3657
|
registerPlugin("editor-gizmo", EditorGizmoPlugin, VFXItem);
|
|
3687
3658
|
/**
|
|
3688
3659
|
* 插件版本号
|
|
3689
|
-
*/ var version = "2.
|
|
3660
|
+
*/ var version = "2.7.0-alpha.0";
|
|
3690
3661
|
logger.info("Plugin editor gizmo version: " + version + ".");
|
|
3691
3662
|
if (version !== EFFECTS.version) {
|
|
3692
3663
|
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!");
|