@galacean/effects-plugin-editor-gizmo 2.7.4 → 2.8.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/gizmo-component.d.ts +15 -12
- package/dist/gizmo-loader.d.ts +2 -10
- package/dist/index.js +463 -520
- 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 +476 -533
- 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.8.0-alpha.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -224,228 +224,6 @@ typeof SuppressedError === "function" ? SuppressedError : function _SuppressedEr
|
|
|
224
224
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
225
225
|
};
|
|
226
226
|
|
|
227
|
-
var GizmoVFXItemType = "gizmo";
|
|
228
|
-
exports.GizmoSubType = void 0;
|
|
229
|
-
(function(GizmoSubType) {
|
|
230
|
-
GizmoSubType[GizmoSubType["particleEmitter"] = 1] = "particleEmitter";
|
|
231
|
-
GizmoSubType[GizmoSubType["modelWireframe"] = 2] = "modelWireframe";
|
|
232
|
-
GizmoSubType[GizmoSubType["box"] = 3] = "box";
|
|
233
|
-
GizmoSubType[GizmoSubType["sphere"] = 4] = "sphere";
|
|
234
|
-
GizmoSubType[GizmoSubType["cylinder"] = 5] = "cylinder";
|
|
235
|
-
GizmoSubType[GizmoSubType["cone"] = 6] = "cone";
|
|
236
|
-
GizmoSubType[GizmoSubType["torus"] = 7] = "torus";
|
|
237
|
-
GizmoSubType[GizmoSubType["sprite"] = 8] = "sprite";
|
|
238
|
-
GizmoSubType[GizmoSubType["plane"] = 9] = "plane";
|
|
239
|
-
GizmoSubType[GizmoSubType["rotation"] = 10] = "rotation";
|
|
240
|
-
GizmoSubType[GizmoSubType["translation"] = 11] = "translation";
|
|
241
|
-
GizmoSubType[GizmoSubType["scale"] = 12] = "scale";
|
|
242
|
-
GizmoSubType[GizmoSubType["viewHelper"] = 13] = "viewHelper";
|
|
243
|
-
GizmoSubType[GizmoSubType["camera"] = 14] = "camera";
|
|
244
|
-
GizmoSubType[GizmoSubType["frustum"] = 15] = "frustum";
|
|
245
|
-
GizmoSubType[GizmoSubType["light"] = 16] = "light";
|
|
246
|
-
GizmoSubType[GizmoSubType["directionLight"] = 17] = "directionLight";
|
|
247
|
-
GizmoSubType[GizmoSubType["pointLight"] = 18] = "pointLight";
|
|
248
|
-
GizmoSubType[GizmoSubType["spotLight"] = 19] = "spotLight";
|
|
249
|
-
GizmoSubType[GizmoSubType["boundingBox"] = 20] = "boundingBox";
|
|
250
|
-
GizmoSubType[GizmoSubType["floorGrid"] = 21] = "floorGrid";
|
|
251
|
-
})(exports.GizmoSubType || (exports.GizmoSubType = {}));
|
|
252
|
-
|
|
253
|
-
function _extends() {
|
|
254
|
-
_extends = Object.assign || function assign(target) {
|
|
255
|
-
for(var i = 1; i < arguments.length; i++){
|
|
256
|
-
var source = arguments[i];
|
|
257
|
-
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
258
|
-
}
|
|
259
|
-
return target;
|
|
260
|
-
};
|
|
261
|
-
return _extends.apply(this, arguments);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
var Vector4 = EFFECTS.math.Vector4;
|
|
265
|
-
var WireframeGeometryType;
|
|
266
|
-
(function(WireframeGeometryType) {
|
|
267
|
-
WireframeGeometryType[WireframeGeometryType["triangle"] = 0] = "triangle";
|
|
268
|
-
WireframeGeometryType[WireframeGeometryType["quad"] = 1] = "quad";
|
|
269
|
-
})(WireframeGeometryType || (WireframeGeometryType = {}));
|
|
270
|
-
function destroyWireframeMesh(mesh) {
|
|
271
|
-
var _mesh_geometry;
|
|
272
|
-
(_mesh_geometry = mesh.geometry) == null ? void 0 : _mesh_geometry.dispose();
|
|
273
|
-
mesh.dispose({
|
|
274
|
-
geometries: EFFECTS.DestroyOptions.keep
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
function updateWireframeMesh(originGeometry, originMaterial, wireframe, type) {
|
|
278
|
-
wireframe.material.cloneUniforms(originMaterial);
|
|
279
|
-
var geometry = originGeometry;
|
|
280
|
-
var wireframeGeometry = wireframe.firstGeometry();
|
|
281
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(originMaterial.enabledMacros)), _step; !(_step = _iterator()).done;){
|
|
282
|
-
var macro = _step.value;
|
|
283
|
-
wireframe.material.enableMacro(macro, originMaterial.enabledMacros[macro]);
|
|
284
|
-
}
|
|
285
|
-
if (type === 0) {
|
|
286
|
-
// 线框模式不绘制模型的时候,drawCount 为负数
|
|
287
|
-
var drawCount = Math.abs(geometry.getDrawCount());
|
|
288
|
-
if (drawCount !== 0) {
|
|
289
|
-
if (drawCount !== wireframeGeometry.getDrawCount() / 2) {
|
|
290
|
-
var indexData = geometry.getIndexData();
|
|
291
|
-
var data = indexData ? getTriangleIndexData(indexData) : getTriangleIndexDataByCount(drawCount);
|
|
292
|
-
wireframeGeometry.setIndexData(data);
|
|
293
|
-
wireframeGeometry.setDrawCount(data.length);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
} else if (type === 1) {
|
|
297
|
-
if (geometry.getDrawCount() / 6 !== wireframeGeometry.getDrawCount() / 8) {
|
|
298
|
-
var data1 = getQuadIndexData(geometry.getDrawCount() / 6, geometry.getIndexData());
|
|
299
|
-
wireframeGeometry.setIndexData(data1);
|
|
300
|
-
wireframeGeometry.setDrawCount(data1.length);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return wireframe;
|
|
304
|
-
}
|
|
305
|
-
function getQuadIndexData(faceCount, oid) {
|
|
306
|
-
var indexData = new Uint16Array(faceCount * 8);
|
|
307
|
-
for(var i = 0; i < faceCount; i++){
|
|
308
|
-
var idx = i * 8;
|
|
309
|
-
var base = i * 4;
|
|
310
|
-
indexData[idx] = base;
|
|
311
|
-
indexData[idx + 1] = 1 + base;
|
|
312
|
-
indexData[idx + 2] = 1 + base;
|
|
313
|
-
indexData[idx + 3] = 3 + base;
|
|
314
|
-
indexData[idx + 4] = 3 + base;
|
|
315
|
-
indexData[idx + 5] = 2 + base;
|
|
316
|
-
indexData[idx + 6] = 2 + base;
|
|
317
|
-
indexData[idx + 7] = base;
|
|
318
|
-
}
|
|
319
|
-
return indexData;
|
|
320
|
-
}
|
|
321
|
-
function createModeWireframe(engine, mesh, color) {
|
|
322
|
-
var geometry = new SharedGeometry(engine, {
|
|
323
|
-
geometry: mesh.firstGeometry(),
|
|
324
|
-
mode: EFFECTS.glContext.LINES,
|
|
325
|
-
index: {
|
|
326
|
-
data: new Uint32Array(0)
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
var _mesh_material_shader_shaderData = mesh.material.shader.shaderData, vertex = _mesh_material_shader_shaderData.vertex, fragment = _mesh_material_shader_shaderData.fragment;
|
|
330
|
-
var materialOptions = _extends({}, mesh.material.props);
|
|
331
|
-
var newMacros = [
|
|
332
|
-
[
|
|
333
|
-
"PREVIEW_BORDER",
|
|
334
|
-
1
|
|
335
|
-
]
|
|
336
|
-
];
|
|
337
|
-
var _mesh_name;
|
|
338
|
-
materialOptions.shader = {
|
|
339
|
-
vertex: vertex,
|
|
340
|
-
fragment: fragment,
|
|
341
|
-
macros: newMacros,
|
|
342
|
-
shared: true,
|
|
343
|
-
name: ((_mesh_name = mesh.name) != null ? _mesh_name : "unamedmesh") + "_wireframe",
|
|
344
|
-
glslVersion: engine.gpuCapability.level === 2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
|
|
345
|
-
};
|
|
346
|
-
var material = EFFECTS.Material.create(engine, materialOptions);
|
|
347
|
-
material.depthTest = true;
|
|
348
|
-
material.setVector4("uPreviewColor", new Vector4(color[0], color[1], color[2], 1));
|
|
349
|
-
return updateWireframeMesh(mesh.geometry, mesh.material, EFFECTS.Mesh.create(engine, {
|
|
350
|
-
geometry: geometry,
|
|
351
|
-
material: material,
|
|
352
|
-
priority: 3000,
|
|
353
|
-
name: materialOptions.shader.name
|
|
354
|
-
}), 0);
|
|
355
|
-
}
|
|
356
|
-
function getTriangleIndexDataByCount(drawCount) {
|
|
357
|
-
var faceCount = drawCount / 3;
|
|
358
|
-
var indexData = new Uint32Array(faceCount * 6);
|
|
359
|
-
for(var i = 0; i < faceCount; i++){
|
|
360
|
-
var idx = i * 6;
|
|
361
|
-
var p0 = i * 3;
|
|
362
|
-
var p1 = p0 + 1;
|
|
363
|
-
var p2 = p0 + 2;
|
|
364
|
-
indexData[idx] = p0;
|
|
365
|
-
indexData[idx + 1] = p1;
|
|
366
|
-
indexData[idx + 2] = p1;
|
|
367
|
-
indexData[idx + 3] = p2;
|
|
368
|
-
indexData[idx + 4] = p2;
|
|
369
|
-
indexData[idx + 5] = p0;
|
|
370
|
-
}
|
|
371
|
-
return indexData;
|
|
372
|
-
}
|
|
373
|
-
function getTriangleIndexData(oid) {
|
|
374
|
-
var faceCount = oid.length / 3;
|
|
375
|
-
var indexData = new Uint32Array(faceCount * 6);
|
|
376
|
-
for(var i = 0; i < faceCount; i++){
|
|
377
|
-
var idx = i * 6;
|
|
378
|
-
var base = i * 3;
|
|
379
|
-
var p0 = oid[base];
|
|
380
|
-
var p1 = oid[base + 1];
|
|
381
|
-
var p2 = oid[base + 2];
|
|
382
|
-
indexData[idx] = p0;
|
|
383
|
-
indexData[idx + 1] = p1;
|
|
384
|
-
indexData[idx + 2] = p1;
|
|
385
|
-
indexData[idx + 3] = p2;
|
|
386
|
-
indexData[idx + 4] = p2;
|
|
387
|
-
indexData[idx + 5] = p0;
|
|
388
|
-
}
|
|
389
|
-
return indexData;
|
|
390
|
-
}
|
|
391
|
-
var SharedGeometry = /*#__PURE__*/ function(GLGeometry) {
|
|
392
|
-
_inherits(SharedGeometry, GLGeometry);
|
|
393
|
-
function SharedGeometry(engine, options) {
|
|
394
|
-
var _this;
|
|
395
|
-
_this = GLGeometry.call(this, engine, _extends({
|
|
396
|
-
attributes: {}
|
|
397
|
-
}, options)) || this;
|
|
398
|
-
var indexData = options.index ? options.index.data : options.geometry.getIndexData();
|
|
399
|
-
if (indexData) {
|
|
400
|
-
//@ts-expect-error safe to assign
|
|
401
|
-
indexData = new indexData.constructor(indexData);
|
|
402
|
-
}
|
|
403
|
-
_this.indices = indexData;
|
|
404
|
-
_this.source = options.geometry;
|
|
405
|
-
_this.drawCount = options.drawCount || 0;
|
|
406
|
-
_this.drawStart = options.drawStart || 0;
|
|
407
|
-
_this.mode = options.mode || 0;
|
|
408
|
-
for(var name in _this.source.attributes){
|
|
409
|
-
_this.attributes[name] = _extends({}, _this.source.attributes[name]);
|
|
410
|
-
}
|
|
411
|
-
return _this;
|
|
412
|
-
}
|
|
413
|
-
var _proto = SharedGeometry.prototype;
|
|
414
|
-
_proto.initialize = function initialize() {
|
|
415
|
-
if (!this.isInitialized) {
|
|
416
|
-
var geometry = this.source;
|
|
417
|
-
geometry.initialize();
|
|
418
|
-
//this.indicesBuffer = this._source.indicesBuffer;
|
|
419
|
-
this.buffers = this.source.buffers;
|
|
420
|
-
this.bufferProps = this.source.bufferProps;
|
|
421
|
-
//this.dirtyFlags = this._source.dirtyFlags;
|
|
422
|
-
//this.vaos = this._source.vaos;
|
|
423
|
-
//创建ibo
|
|
424
|
-
if (this.indices) {
|
|
425
|
-
this.indicesBuffer = this.createIndicesBuffer(this.indices);
|
|
426
|
-
}
|
|
427
|
-
this.flush();
|
|
428
|
-
this.initialized = true;
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
_proto.getAttributeNames = function getAttributeNames() {
|
|
432
|
-
return this.source.getAttributeNames();
|
|
433
|
-
};
|
|
434
|
-
_proto.flush = function flush() {
|
|
435
|
-
this.source.flush();
|
|
436
|
-
GLGeometry.prototype.flush.call(this);
|
|
437
|
-
};
|
|
438
|
-
_proto.dispose = function dispose() {
|
|
439
|
-
// from source geometry
|
|
440
|
-
this.buffers = {};
|
|
441
|
-
this.bufferProps = {};
|
|
442
|
-
GLGeometry.prototype.dispose.call(this);
|
|
443
|
-
// @ts-expect-error
|
|
444
|
-
this.source = null;
|
|
445
|
-
};
|
|
446
|
-
return SharedGeometry;
|
|
447
|
-
}(EFFECTS.GLGeometry);
|
|
448
|
-
|
|
449
227
|
// 坐标轴默认颜色
|
|
450
228
|
var color = {
|
|
451
229
|
xAxisColor: [
|
|
@@ -530,6 +308,121 @@ function _createImage() {
|
|
|
530
308
|
return currentPos.clone().add(vecItemScaler);
|
|
531
309
|
}
|
|
532
310
|
|
|
311
|
+
exports.GizmoSubType = void 0;
|
|
312
|
+
(function(GizmoSubType) {
|
|
313
|
+
GizmoSubType[GizmoSubType["particleEmitter"] = 1] = "particleEmitter";
|
|
314
|
+
GizmoSubType[GizmoSubType["modelWireframe"] = 2] = "modelWireframe";
|
|
315
|
+
GizmoSubType[GizmoSubType["box"] = 3] = "box";
|
|
316
|
+
GizmoSubType[GizmoSubType["sphere"] = 4] = "sphere";
|
|
317
|
+
GizmoSubType[GizmoSubType["cylinder"] = 5] = "cylinder";
|
|
318
|
+
GizmoSubType[GizmoSubType["cone"] = 6] = "cone";
|
|
319
|
+
GizmoSubType[GizmoSubType["torus"] = 7] = "torus";
|
|
320
|
+
GizmoSubType[GizmoSubType["sprite"] = 8] = "sprite";
|
|
321
|
+
GizmoSubType[GizmoSubType["plane"] = 9] = "plane";
|
|
322
|
+
GizmoSubType[GizmoSubType["rotation"] = 10] = "rotation";
|
|
323
|
+
GizmoSubType[GizmoSubType["translation"] = 11] = "translation";
|
|
324
|
+
GizmoSubType[GizmoSubType["scale"] = 12] = "scale";
|
|
325
|
+
GizmoSubType[GizmoSubType["viewHelper"] = 13] = "viewHelper";
|
|
326
|
+
GizmoSubType[GizmoSubType["camera"] = 14] = "camera";
|
|
327
|
+
GizmoSubType[GizmoSubType["frustum"] = 15] = "frustum";
|
|
328
|
+
GizmoSubType[GizmoSubType["light"] = 16] = "light";
|
|
329
|
+
GizmoSubType[GizmoSubType["directionLight"] = 17] = "directionLight";
|
|
330
|
+
GizmoSubType[GizmoSubType["pointLight"] = 18] = "pointLight";
|
|
331
|
+
GizmoSubType[GizmoSubType["spotLight"] = 19] = "spotLight";
|
|
332
|
+
GizmoSubType[GizmoSubType["boundingBox"] = 20] = "boundingBox";
|
|
333
|
+
GizmoSubType[GizmoSubType["floorGrid"] = 21] = "floorGrid";
|
|
334
|
+
})(exports.GizmoSubType || (exports.GizmoSubType = {}));
|
|
335
|
+
|
|
336
|
+
EFFECTS.math.Vector3; EFFECTS.math.Ray;
|
|
337
|
+
var BoundingType;
|
|
338
|
+
(function(BoundingType) {
|
|
339
|
+
BoundingType[BoundingType["box"] = 0] = "box";
|
|
340
|
+
BoundingType[BoundingType["sphere"] = 1] = "sphere";
|
|
341
|
+
BoundingType[BoundingType["triangle"] = 2] = "triangle";
|
|
342
|
+
BoundingType[BoundingType["line"] = 3] = "line";
|
|
343
|
+
})(BoundingType || (BoundingType = {}));
|
|
344
|
+
|
|
345
|
+
var Matrix4$5 = EFFECTS.math.Matrix4, Vector2$2 = EFFECTS.math.Vector2;
|
|
346
|
+
function distanceOfPointAndLine(point, line) {
|
|
347
|
+
//三角形三个边长
|
|
348
|
+
var AC = new Vector2$2();
|
|
349
|
+
var BC = new Vector2$2();
|
|
350
|
+
var AB = new Vector2$2();
|
|
351
|
+
AC.subtractVectors(point, line[0]);
|
|
352
|
+
BC.subtractVectors(point, line[1]);
|
|
353
|
+
AB.subtractVectors(line[1], line[0]);
|
|
354
|
+
var lengthAC = AC.length();
|
|
355
|
+
var lengthBC = BC.length();
|
|
356
|
+
var lengthAB = AB.length();
|
|
357
|
+
//利用海伦公式计算三角形面积
|
|
358
|
+
//周长的一半
|
|
359
|
+
var P = (lengthAC + lengthBC + lengthAB) / 2;
|
|
360
|
+
var allArea = Math.abs(Math.sqrt(P * (P - lengthAC) * (P - lengthBC) * (P - lengthAB)));
|
|
361
|
+
//普通公式计算三角形面积反推点到线的垂直距离
|
|
362
|
+
var distance = 2 * allArea / lengthAB;
|
|
363
|
+
var l1 = Math.sqrt(Math.pow(lengthAC, 2) - Math.pow(distance, 2));
|
|
364
|
+
var l2 = Math.sqrt(Math.pow(lengthBC, 2) - Math.pow(distance, 2));
|
|
365
|
+
var isInLine = false;
|
|
366
|
+
if (l1 <= lengthAB && l2 <= lengthAB) {
|
|
367
|
+
isInLine = true;
|
|
368
|
+
}
|
|
369
|
+
return {
|
|
370
|
+
distance: distance,
|
|
371
|
+
isInLine: isInLine
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function projectionOfPointAndLine(point, line) {
|
|
375
|
+
var AC = new Vector2$2();
|
|
376
|
+
var BC = new Vector2$2();
|
|
377
|
+
var AB = new Vector2$2();
|
|
378
|
+
var line0 = line[0].toVector2();
|
|
379
|
+
var line1 = line[1].toVector2();
|
|
380
|
+
AC.subtractVectors(point, line0);
|
|
381
|
+
BC.subtractVectors(point, line1);
|
|
382
|
+
AB.subtractVectors(line1, line0);
|
|
383
|
+
var lengthAC = AC.length();
|
|
384
|
+
var lengthBC = BC.length();
|
|
385
|
+
var lengthAB = AB.length();
|
|
386
|
+
//利用海伦公式计算三角形面积
|
|
387
|
+
//周长的一半
|
|
388
|
+
var P = (lengthAC + lengthBC + lengthAB) / 2;
|
|
389
|
+
var allArea = Math.abs(Math.sqrt(P * (P - lengthAC) * (P - lengthBC) * (P - lengthAB)));
|
|
390
|
+
//普通公式计算三角形面积反推点到线的垂直距离
|
|
391
|
+
var distance = 2 * allArea / lengthAB;
|
|
392
|
+
var l1 = Math.sqrt(Math.pow(lengthAC, 2) - Math.pow(distance, 2));
|
|
393
|
+
var l2 = Math.sqrt(Math.pow(lengthBC, 2) - Math.pow(distance, 2));
|
|
394
|
+
var worldAB = line[1].clone().subtract(line[0]);
|
|
395
|
+
var worldAP = worldAB.clone().multiply(l1 / (l1 + l2));
|
|
396
|
+
var worldP = line[0].clone().add(worldAP);
|
|
397
|
+
return worldP;
|
|
398
|
+
}
|
|
399
|
+
function computeOrthographicOffCenter(left, right, bottom, top, near, far) {
|
|
400
|
+
var a = 1.0 / (right - left);
|
|
401
|
+
var b = 1.0 / (top - bottom);
|
|
402
|
+
var c = 1.0 / (far - near);
|
|
403
|
+
var tx = -(right + left) * a;
|
|
404
|
+
var ty = -(top + bottom) * b;
|
|
405
|
+
var tz = -(far + near) * c;
|
|
406
|
+
a *= 2.0;
|
|
407
|
+
b *= 2.0;
|
|
408
|
+
c *= -2.0;
|
|
409
|
+
return new Matrix4$5(a, 0.0, 0.0, 0.0, //
|
|
410
|
+
0.0, b, 0.0, 0.0, //
|
|
411
|
+
0.0, 0.0, c, 0.0, //
|
|
412
|
+
tx, ty, tz, 1.0);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function _extends() {
|
|
416
|
+
_extends = Object.assign || function assign(target) {
|
|
417
|
+
for(var i = 1; i < arguments.length; i++){
|
|
418
|
+
var source = arguments[i];
|
|
419
|
+
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
420
|
+
}
|
|
421
|
+
return target;
|
|
422
|
+
};
|
|
423
|
+
return _extends.apply(this, arguments);
|
|
424
|
+
}
|
|
425
|
+
|
|
533
426
|
/**
|
|
534
427
|
* 基础几何数据[抽象类,不可以直接用来初始化]
|
|
535
428
|
*/ var GeometryData = /*#__PURE__*/ function() {
|
|
@@ -944,7 +837,7 @@ var Vector3$5 = EFFECTS.math.Vector3;
|
|
|
944
837
|
return PlaneGeometryData;
|
|
945
838
|
}(GeometryData);
|
|
946
839
|
|
|
947
|
-
var Euler$1 = EFFECTS.math.Euler, Vector3$4 = EFFECTS.math.Vector3, Matrix4$
|
|
840
|
+
var Euler$1 = EFFECTS.math.Euler, Vector3$4 = EFFECTS.math.Vector3, Matrix4$4 = EFFECTS.math.Matrix4;
|
|
948
841
|
/**
|
|
949
842
|
*
|
|
950
843
|
*/ var FrustumGeometryData = /*#__PURE__*/ function(GeometryData) {
|
|
@@ -961,7 +854,7 @@ var Euler$1 = EFFECTS.math.Euler, Vector3$4 = EFFECTS.math.Vector3, Matrix4$5 =
|
|
|
961
854
|
var point2 = new Vector3$4(-halfX, halfY, far);
|
|
962
855
|
var point3 = new Vector3$4(-halfX, -halfY, far);
|
|
963
856
|
var point4 = new Vector3$4(halfX, -halfY, far);
|
|
964
|
-
var matrix = Euler$1.fromArray(rotation).toMatrix4(new Matrix4$
|
|
857
|
+
var matrix = Euler$1.fromArray(rotation).toMatrix4(new Matrix4$4());
|
|
965
858
|
var result1 = matrix.transformPoint(point1).add(position);
|
|
966
859
|
var result2 = matrix.transformPoint(point2).add(position);
|
|
967
860
|
var result3 = matrix.transformPoint(point3).add(position);
|
|
@@ -1184,85 +1077,6 @@ exports.GeometryType = void 0;
|
|
|
1184
1077
|
return result;
|
|
1185
1078
|
}
|
|
1186
1079
|
|
|
1187
|
-
EFFECTS.math.Vector3; EFFECTS.math.Ray;
|
|
1188
|
-
var BoundingType;
|
|
1189
|
-
(function(BoundingType) {
|
|
1190
|
-
BoundingType[BoundingType["box"] = 0] = "box";
|
|
1191
|
-
BoundingType[BoundingType["sphere"] = 1] = "sphere";
|
|
1192
|
-
BoundingType[BoundingType["triangle"] = 2] = "triangle";
|
|
1193
|
-
BoundingType[BoundingType["line"] = 3] = "line";
|
|
1194
|
-
})(BoundingType || (BoundingType = {}));
|
|
1195
|
-
|
|
1196
|
-
var Matrix4$4 = EFFECTS.math.Matrix4, Vector2$2 = EFFECTS.math.Vector2;
|
|
1197
|
-
function distanceOfPointAndLine(point, line) {
|
|
1198
|
-
//三角形三个边长
|
|
1199
|
-
var AC = new Vector2$2();
|
|
1200
|
-
var BC = new Vector2$2();
|
|
1201
|
-
var AB = new Vector2$2();
|
|
1202
|
-
AC.subtractVectors(point, line[0]);
|
|
1203
|
-
BC.subtractVectors(point, line[1]);
|
|
1204
|
-
AB.subtractVectors(line[1], line[0]);
|
|
1205
|
-
var lengthAC = AC.length();
|
|
1206
|
-
var lengthBC = BC.length();
|
|
1207
|
-
var lengthAB = AB.length();
|
|
1208
|
-
//利用海伦公式计算三角形面积
|
|
1209
|
-
//周长的一半
|
|
1210
|
-
var P = (lengthAC + lengthBC + lengthAB) / 2;
|
|
1211
|
-
var allArea = Math.abs(Math.sqrt(P * (P - lengthAC) * (P - lengthBC) * (P - lengthAB)));
|
|
1212
|
-
//普通公式计算三角形面积反推点到线的垂直距离
|
|
1213
|
-
var distance = 2 * allArea / lengthAB;
|
|
1214
|
-
var l1 = Math.sqrt(Math.pow(lengthAC, 2) - Math.pow(distance, 2));
|
|
1215
|
-
var l2 = Math.sqrt(Math.pow(lengthBC, 2) - Math.pow(distance, 2));
|
|
1216
|
-
var isInLine = false;
|
|
1217
|
-
if (l1 <= lengthAB && l2 <= lengthAB) {
|
|
1218
|
-
isInLine = true;
|
|
1219
|
-
}
|
|
1220
|
-
return {
|
|
1221
|
-
distance: distance,
|
|
1222
|
-
isInLine: isInLine
|
|
1223
|
-
};
|
|
1224
|
-
}
|
|
1225
|
-
function projectionOfPointAndLine(point, line) {
|
|
1226
|
-
var AC = new Vector2$2();
|
|
1227
|
-
var BC = new Vector2$2();
|
|
1228
|
-
var AB = new Vector2$2();
|
|
1229
|
-
var line0 = line[0].toVector2();
|
|
1230
|
-
var line1 = line[1].toVector2();
|
|
1231
|
-
AC.subtractVectors(point, line0);
|
|
1232
|
-
BC.subtractVectors(point, line1);
|
|
1233
|
-
AB.subtractVectors(line1, line0);
|
|
1234
|
-
var lengthAC = AC.length();
|
|
1235
|
-
var lengthBC = BC.length();
|
|
1236
|
-
var lengthAB = AB.length();
|
|
1237
|
-
//利用海伦公式计算三角形面积
|
|
1238
|
-
//周长的一半
|
|
1239
|
-
var P = (lengthAC + lengthBC + lengthAB) / 2;
|
|
1240
|
-
var allArea = Math.abs(Math.sqrt(P * (P - lengthAC) * (P - lengthBC) * (P - lengthAB)));
|
|
1241
|
-
//普通公式计算三角形面积反推点到线的垂直距离
|
|
1242
|
-
var distance = 2 * allArea / lengthAB;
|
|
1243
|
-
var l1 = Math.sqrt(Math.pow(lengthAC, 2) - Math.pow(distance, 2));
|
|
1244
|
-
var l2 = Math.sqrt(Math.pow(lengthBC, 2) - Math.pow(distance, 2));
|
|
1245
|
-
var worldAB = line[1].clone().subtract(line[0]);
|
|
1246
|
-
var worldAP = worldAB.clone().multiply(l1 / (l1 + l2));
|
|
1247
|
-
var worldP = line[0].clone().add(worldAP);
|
|
1248
|
-
return worldP;
|
|
1249
|
-
}
|
|
1250
|
-
function computeOrthographicOffCenter(left, right, bottom, top, near, far) {
|
|
1251
|
-
var a = 1.0 / (right - left);
|
|
1252
|
-
var b = 1.0 / (top - bottom);
|
|
1253
|
-
var c = 1.0 / (far - near);
|
|
1254
|
-
var tx = -(right + left) * a;
|
|
1255
|
-
var ty = -(top + bottom) * b;
|
|
1256
|
-
var tz = -(far + near) * c;
|
|
1257
|
-
a *= 2.0;
|
|
1258
|
-
b *= 2.0;
|
|
1259
|
-
c *= -2.0;
|
|
1260
|
-
return new Matrix4$4(a, 0.0, 0.0, 0.0, //
|
|
1261
|
-
0.0, b, 0.0, 0.0, //
|
|
1262
|
-
0.0, 0.0, c, 0.0, //
|
|
1263
|
-
tx, ty, tz, 1.0);
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
1080
|
var Vector2$1 = EFFECTS.math.Vector2, Vector3$3 = EFFECTS.math.Vector3, Matrix4$3 = EFFECTS.math.Matrix4;
|
|
1267
1081
|
/**
|
|
1268
1082
|
* 根据 gizmoSubType 类型创建几何体 Mesh
|
|
@@ -2770,21 +2584,209 @@ function createMesh(engine, points, indices, color, depthTest, name) {
|
|
|
2770
2584
|
size: 3,
|
|
2771
2585
|
data: points
|
|
2772
2586
|
}
|
|
2773
|
-
},
|
|
2774
|
-
indices: {
|
|
2775
|
-
data: indices
|
|
2776
|
-
},
|
|
2777
|
-
mode: EFFECTS.glContext.LINES,
|
|
2778
|
-
drawCount: indices.length
|
|
2779
|
-
});
|
|
2780
|
-
return EFFECTS.Mesh.create(engine, {
|
|
2781
|
-
name: name,
|
|
2782
|
-
geometry: geometry,
|
|
2783
|
-
material: material,
|
|
2784
|
-
priority: 3000
|
|
2785
|
-
});
|
|
2786
|
-
}
|
|
2587
|
+
},
|
|
2588
|
+
indices: {
|
|
2589
|
+
data: indices
|
|
2590
|
+
},
|
|
2591
|
+
mode: EFFECTS.glContext.LINES,
|
|
2592
|
+
drawCount: indices.length
|
|
2593
|
+
});
|
|
2594
|
+
return EFFECTS.Mesh.create(engine, {
|
|
2595
|
+
name: name,
|
|
2596
|
+
geometry: geometry,
|
|
2597
|
+
material: material,
|
|
2598
|
+
priority: 3000
|
|
2599
|
+
});
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
var Vector4 = EFFECTS.math.Vector4;
|
|
2603
|
+
var WireframeGeometryType;
|
|
2604
|
+
(function(WireframeGeometryType) {
|
|
2605
|
+
WireframeGeometryType[WireframeGeometryType["triangle"] = 0] = "triangle";
|
|
2606
|
+
WireframeGeometryType[WireframeGeometryType["quad"] = 1] = "quad";
|
|
2607
|
+
})(WireframeGeometryType || (WireframeGeometryType = {}));
|
|
2608
|
+
function destroyWireframeMesh(mesh) {
|
|
2609
|
+
var _mesh_geometry;
|
|
2610
|
+
(_mesh_geometry = mesh.geometry) == null ? void 0 : _mesh_geometry.dispose();
|
|
2611
|
+
mesh.dispose({
|
|
2612
|
+
geometries: EFFECTS.DestroyOptions.keep
|
|
2613
|
+
});
|
|
2614
|
+
}
|
|
2615
|
+
function updateWireframeMesh(originGeometry, originMaterial, wireframe, type) {
|
|
2616
|
+
wireframe.material.cloneUniforms(originMaterial);
|
|
2617
|
+
var geometry = originGeometry;
|
|
2618
|
+
var wireframeGeometry = wireframe.firstGeometry();
|
|
2619
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(originMaterial.enabledMacros)), _step; !(_step = _iterator()).done;){
|
|
2620
|
+
var macro = _step.value;
|
|
2621
|
+
wireframe.material.enableMacro(macro, originMaterial.enabledMacros[macro]);
|
|
2622
|
+
}
|
|
2623
|
+
if (type === 0) {
|
|
2624
|
+
// 线框模式不绘制模型的时候,drawCount 为负数
|
|
2625
|
+
var drawCount = Math.abs(geometry.getDrawCount());
|
|
2626
|
+
if (drawCount !== 0) {
|
|
2627
|
+
if (drawCount !== wireframeGeometry.getDrawCount() / 2) {
|
|
2628
|
+
var indexData = geometry.getIndexData();
|
|
2629
|
+
var data = indexData ? getTriangleIndexData(indexData) : getTriangleIndexDataByCount(drawCount);
|
|
2630
|
+
wireframeGeometry.setIndexData(data);
|
|
2631
|
+
wireframeGeometry.setDrawCount(data.length);
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
} else if (type === 1) {
|
|
2635
|
+
if (geometry.getDrawCount() / 6 !== wireframeGeometry.getDrawCount() / 8) {
|
|
2636
|
+
var data1 = getQuadIndexData(geometry.getDrawCount() / 6, geometry.getIndexData());
|
|
2637
|
+
wireframeGeometry.setIndexData(data1);
|
|
2638
|
+
wireframeGeometry.setDrawCount(data1.length);
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
return wireframe;
|
|
2642
|
+
}
|
|
2643
|
+
function getQuadIndexData(faceCount, oid) {
|
|
2644
|
+
var indexData = new Uint16Array(faceCount * 8);
|
|
2645
|
+
for(var i = 0; i < faceCount; i++){
|
|
2646
|
+
var idx = i * 8;
|
|
2647
|
+
var base = i * 4;
|
|
2648
|
+
indexData[idx] = base;
|
|
2649
|
+
indexData[idx + 1] = 1 + base;
|
|
2650
|
+
indexData[idx + 2] = 1 + base;
|
|
2651
|
+
indexData[idx + 3] = 3 + base;
|
|
2652
|
+
indexData[idx + 4] = 3 + base;
|
|
2653
|
+
indexData[idx + 5] = 2 + base;
|
|
2654
|
+
indexData[idx + 6] = 2 + base;
|
|
2655
|
+
indexData[idx + 7] = base;
|
|
2656
|
+
}
|
|
2657
|
+
return indexData;
|
|
2658
|
+
}
|
|
2659
|
+
function createModeWireframe(engine, mesh, color) {
|
|
2660
|
+
var geometry = new SharedGeometry(engine, {
|
|
2661
|
+
geometry: mesh.firstGeometry(),
|
|
2662
|
+
mode: EFFECTS.glContext.LINES,
|
|
2663
|
+
index: {
|
|
2664
|
+
data: new Uint32Array(0)
|
|
2665
|
+
}
|
|
2666
|
+
});
|
|
2667
|
+
var _mesh_material_shader_shaderData = mesh.material.shader.shaderData, vertex = _mesh_material_shader_shaderData.vertex, fragment = _mesh_material_shader_shaderData.fragment;
|
|
2668
|
+
var materialOptions = _extends({}, mesh.material.props);
|
|
2669
|
+
var newMacros = [
|
|
2670
|
+
[
|
|
2671
|
+
"PREVIEW_BORDER",
|
|
2672
|
+
1
|
|
2673
|
+
]
|
|
2674
|
+
];
|
|
2675
|
+
var _mesh_name;
|
|
2676
|
+
materialOptions.shader = {
|
|
2677
|
+
vertex: vertex,
|
|
2678
|
+
fragment: fragment,
|
|
2679
|
+
macros: newMacros,
|
|
2680
|
+
shared: true,
|
|
2681
|
+
name: ((_mesh_name = mesh.name) != null ? _mesh_name : "unamedmesh") + "_wireframe",
|
|
2682
|
+
glslVersion: engine.gpuCapability.level === 2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
|
|
2683
|
+
};
|
|
2684
|
+
var material = EFFECTS.Material.create(engine, materialOptions);
|
|
2685
|
+
material.depthTest = true;
|
|
2686
|
+
material.setVector4("uPreviewColor", new Vector4(color[0], color[1], color[2], 1));
|
|
2687
|
+
return updateWireframeMesh(mesh.geometry, mesh.material, EFFECTS.Mesh.create(engine, {
|
|
2688
|
+
geometry: geometry,
|
|
2689
|
+
material: material,
|
|
2690
|
+
priority: 3000,
|
|
2691
|
+
name: materialOptions.shader.name
|
|
2692
|
+
}), 0);
|
|
2693
|
+
}
|
|
2694
|
+
function getTriangleIndexDataByCount(drawCount) {
|
|
2695
|
+
var faceCount = drawCount / 3;
|
|
2696
|
+
var indexData = new Uint32Array(faceCount * 6);
|
|
2697
|
+
for(var i = 0; i < faceCount; i++){
|
|
2698
|
+
var idx = i * 6;
|
|
2699
|
+
var p0 = i * 3;
|
|
2700
|
+
var p1 = p0 + 1;
|
|
2701
|
+
var p2 = p0 + 2;
|
|
2702
|
+
indexData[idx] = p0;
|
|
2703
|
+
indexData[idx + 1] = p1;
|
|
2704
|
+
indexData[idx + 2] = p1;
|
|
2705
|
+
indexData[idx + 3] = p2;
|
|
2706
|
+
indexData[idx + 4] = p2;
|
|
2707
|
+
indexData[idx + 5] = p0;
|
|
2708
|
+
}
|
|
2709
|
+
return indexData;
|
|
2710
|
+
}
|
|
2711
|
+
function getTriangleIndexData(oid) {
|
|
2712
|
+
var faceCount = oid.length / 3;
|
|
2713
|
+
var indexData = new Uint32Array(faceCount * 6);
|
|
2714
|
+
for(var i = 0; i < faceCount; i++){
|
|
2715
|
+
var idx = i * 6;
|
|
2716
|
+
var base = i * 3;
|
|
2717
|
+
var p0 = oid[base];
|
|
2718
|
+
var p1 = oid[base + 1];
|
|
2719
|
+
var p2 = oid[base + 2];
|
|
2720
|
+
indexData[idx] = p0;
|
|
2721
|
+
indexData[idx + 1] = p1;
|
|
2722
|
+
indexData[idx + 2] = p1;
|
|
2723
|
+
indexData[idx + 3] = p2;
|
|
2724
|
+
indexData[idx + 4] = p2;
|
|
2725
|
+
indexData[idx + 5] = p0;
|
|
2726
|
+
}
|
|
2727
|
+
return indexData;
|
|
2728
|
+
}
|
|
2729
|
+
var SharedGeometry = /*#__PURE__*/ function(GLGeometry) {
|
|
2730
|
+
_inherits(SharedGeometry, GLGeometry);
|
|
2731
|
+
function SharedGeometry(engine, options) {
|
|
2732
|
+
var _this;
|
|
2733
|
+
_this = GLGeometry.call(this, engine, _extends({
|
|
2734
|
+
attributes: {}
|
|
2735
|
+
}, options)) || this;
|
|
2736
|
+
var indexData = options.index ? options.index.data : options.geometry.getIndexData();
|
|
2737
|
+
if (indexData) {
|
|
2738
|
+
//@ts-expect-error safe to assign
|
|
2739
|
+
indexData = new indexData.constructor(indexData);
|
|
2740
|
+
}
|
|
2741
|
+
_this.indices = indexData;
|
|
2742
|
+
_this.source = options.geometry;
|
|
2743
|
+
_this.drawCount = options.drawCount || 0;
|
|
2744
|
+
_this.drawStart = options.drawStart || 0;
|
|
2745
|
+
_this.mode = options.mode || 0;
|
|
2746
|
+
for(var name in _this.source.attributes){
|
|
2747
|
+
_this.attributes[name] = _extends({}, _this.source.attributes[name]);
|
|
2748
|
+
}
|
|
2749
|
+
return _this;
|
|
2750
|
+
}
|
|
2751
|
+
var _proto = SharedGeometry.prototype;
|
|
2752
|
+
_proto.initialize = function initialize() {
|
|
2753
|
+
if (!this.isInitialized) {
|
|
2754
|
+
var geometry = this.source;
|
|
2755
|
+
geometry.initialize();
|
|
2756
|
+
//this.indicesBuffer = this._source.indicesBuffer;
|
|
2757
|
+
this.buffers = this.source.buffers;
|
|
2758
|
+
this.bufferProps = this.source.bufferProps;
|
|
2759
|
+
//this.dirtyFlags = this._source.dirtyFlags;
|
|
2760
|
+
//this.vaos = this._source.vaos;
|
|
2761
|
+
//创建ibo
|
|
2762
|
+
if (this.indices) {
|
|
2763
|
+
this.indicesBuffer = this.createIndicesBuffer(this.indices);
|
|
2764
|
+
}
|
|
2765
|
+
this.flush();
|
|
2766
|
+
this.initialized = true;
|
|
2767
|
+
}
|
|
2768
|
+
};
|
|
2769
|
+
_proto.getAttributeNames = function getAttributeNames() {
|
|
2770
|
+
return this.source.getAttributeNames();
|
|
2771
|
+
};
|
|
2772
|
+
_proto.flush = function flush() {
|
|
2773
|
+
this.source.flush();
|
|
2774
|
+
GLGeometry.prototype.flush.call(this);
|
|
2775
|
+
};
|
|
2776
|
+
_proto.dispose = function dispose() {
|
|
2777
|
+
// from source geometry
|
|
2778
|
+
this.buffers = {};
|
|
2779
|
+
this.bufferProps = {};
|
|
2780
|
+
GLGeometry.prototype.dispose.call(this);
|
|
2781
|
+
// @ts-expect-error
|
|
2782
|
+
this.source = null;
|
|
2783
|
+
};
|
|
2784
|
+
return SharedGeometry;
|
|
2785
|
+
}(EFFECTS.GLGeometry);
|
|
2787
2786
|
|
|
2787
|
+
var editorRenderPassName = "editor-gizmo";
|
|
2788
|
+
var frontRenderPassName = "front-gizmo";
|
|
2789
|
+
var behindRenderPassName = "behind-gizmo";
|
|
2788
2790
|
var Vector2 = EFFECTS.math.Vector2, Vector3 = EFFECTS.math.Vector3, Matrix4 = EFFECTS.math.Matrix4, Quaternion = EFFECTS.math.Quaternion;
|
|
2789
2791
|
var constants = EFFECTS.glContext;
|
|
2790
2792
|
exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
@@ -2796,6 +2798,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
2796
2798
|
_this.coordinateSpace = 0;
|
|
2797
2799
|
_this.mat = Matrix4.fromIdentity();
|
|
2798
2800
|
_this.wireframeMeshes = [];
|
|
2801
|
+
_this.meshes = [];
|
|
2799
2802
|
_this.mesh = null;
|
|
2800
2803
|
/**
|
|
2801
2804
|
* 射线检测算法
|
|
@@ -3030,11 +3033,11 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3030
3033
|
var gizmoSubType = this.subType;
|
|
3031
3034
|
switch(gizmoSubType){
|
|
3032
3035
|
case exports.GizmoSubType.particleEmitter:
|
|
3033
|
-
this.createParticleContent(targetItem
|
|
3036
|
+
this.createParticleContent(targetItem);
|
|
3034
3037
|
break;
|
|
3035
3038
|
case exports.GizmoSubType.modelWireframe:
|
|
3036
3039
|
this.needCreateModelContent = true;
|
|
3037
|
-
this.createModelContent(targetItem
|
|
3040
|
+
this.createModelContent(targetItem);
|
|
3038
3041
|
break;
|
|
3039
3042
|
case exports.GizmoSubType.box:
|
|
3040
3043
|
case exports.GizmoSubType.sphere:
|
|
@@ -3047,29 +3050,111 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3047
3050
|
case exports.GizmoSubType.pointLight:
|
|
3048
3051
|
case exports.GizmoSubType.spotLight:
|
|
3049
3052
|
case exports.GizmoSubType.floorGrid:
|
|
3050
|
-
this.createBasicContent(targetItem,
|
|
3053
|
+
this.createBasicContent(targetItem, gizmoSubType);
|
|
3051
3054
|
break;
|
|
3052
3055
|
case exports.GizmoSubType.camera:
|
|
3053
3056
|
case exports.GizmoSubType.light:
|
|
3054
|
-
this.createBasicContent(targetItem,
|
|
3057
|
+
this.createBasicContent(targetItem, gizmoSubType, iconTextures);
|
|
3055
3058
|
break;
|
|
3056
3059
|
case exports.GizmoSubType.rotation:
|
|
3057
3060
|
case exports.GizmoSubType.scale:
|
|
3058
3061
|
case exports.GizmoSubType.translation:
|
|
3059
|
-
this.createCombinationContent(targetItem,
|
|
3062
|
+
this.createCombinationContent(targetItem, gizmoSubType);
|
|
3060
3063
|
break;
|
|
3061
3064
|
case exports.GizmoSubType.viewHelper:
|
|
3062
|
-
this.createCombinationContent(targetItem,
|
|
3065
|
+
this.createCombinationContent(targetItem, gizmoSubType, iconTextures);
|
|
3063
3066
|
break;
|
|
3064
3067
|
case exports.GizmoSubType.boundingBox:
|
|
3065
|
-
this.createBoundingBoxContent(targetItem
|
|
3068
|
+
this.createBoundingBoxContent(targetItem);
|
|
3066
3069
|
break;
|
|
3067
3070
|
}
|
|
3068
3071
|
composition == null ? void 0 : composition.loaderData.gizmoItems.push(this.item);
|
|
3069
3072
|
};
|
|
3073
|
+
_proto.onEnable = function onEnable() {
|
|
3074
|
+
RendererComponent1.prototype.onEnable.call(this);
|
|
3075
|
+
if (!this.item.composition) {
|
|
3076
|
+
return;
|
|
3077
|
+
}
|
|
3078
|
+
var renderFrame = this.item.composition.renderFrame;
|
|
3079
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
3080
|
+
var mesh = _step.value;
|
|
3081
|
+
if (mesh.name === exports.GeometryType.FloorGrid.toString() || mesh.name === "Box") {
|
|
3082
|
+
this.getFrontRenderPass(renderFrame).addMesh(mesh);
|
|
3083
|
+
} else if (mesh.name === "translation" || mesh.name === "scale" || mesh.name === "rotation") {
|
|
3084
|
+
this.getBehindRenderPass(renderFrame).addMesh(mesh);
|
|
3085
|
+
} else {
|
|
3086
|
+
this.getEditorRenderPass(renderFrame).addMesh(mesh);
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
};
|
|
3090
|
+
_proto.onDisable = function onDisable() {
|
|
3091
|
+
RendererComponent1.prototype.onDisable.call(this);
|
|
3092
|
+
if (!this.item.composition) {
|
|
3093
|
+
return;
|
|
3094
|
+
}
|
|
3095
|
+
var renderFrame = this.item.composition.renderFrame;
|
|
3096
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
3097
|
+
var mesh = _step.value;
|
|
3098
|
+
if (mesh.name === exports.GeometryType.FloorGrid.toString() || mesh.name === "Box") {
|
|
3099
|
+
this.getFrontRenderPass(renderFrame).removeMesh(mesh);
|
|
3100
|
+
} else if (mesh.name === "translation" || mesh.name === "scale" || mesh.name === "rotation") {
|
|
3101
|
+
this.getBehindRenderPass(renderFrame).removeMesh(mesh);
|
|
3102
|
+
} else {
|
|
3103
|
+
this.getEditorRenderPass(renderFrame).removeMesh(mesh);
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
};
|
|
3070
3107
|
_proto.onUpdate = function onUpdate(dt) {
|
|
3071
3108
|
this.updateRenderData();
|
|
3072
3109
|
};
|
|
3110
|
+
_proto.onDestroy = function onDestroy() {
|
|
3111
|
+
var _this = this;
|
|
3112
|
+
var gizmoMesh = this.mesh;
|
|
3113
|
+
var composition = this.item.composition;
|
|
3114
|
+
if (!composition) {
|
|
3115
|
+
return;
|
|
3116
|
+
}
|
|
3117
|
+
if (gizmoMesh && !gizmoMesh.isDestroyed) {
|
|
3118
|
+
gizmoMesh.dispose();
|
|
3119
|
+
if (gizmoMesh.name === exports.GeometryType.FloorGrid.toString() || gizmoMesh.name === "Box") {
|
|
3120
|
+
this.getFrontRenderPass(composition.renderFrame).removeMesh(gizmoMesh);
|
|
3121
|
+
} else {
|
|
3122
|
+
this.getEditorRenderPass(composition.renderFrame).removeMesh(gizmoMesh);
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
if (this.contents) {
|
|
3126
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.contents), _step; !(_step = _iterator()).done;){
|
|
3127
|
+
var _step_value = _step.value, mesh = _step_value[0];
|
|
3128
|
+
if (!mesh.isDestroyed) {
|
|
3129
|
+
mesh.dispose();
|
|
3130
|
+
if (mesh.name === "translation" || mesh.name === "scale" || mesh.name === "rotation") {
|
|
3131
|
+
this.getBehindRenderPass(composition.renderFrame).removeMesh(mesh);
|
|
3132
|
+
} else {
|
|
3133
|
+
this.getEditorRenderPass(composition.renderFrame).removeMesh(mesh);
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
if (this && this.wireframeMeshes.length > 0) {
|
|
3139
|
+
this.wireframeMeshes.forEach(function(mesh) {
|
|
3140
|
+
if (!mesh.isDestroyed) {
|
|
3141
|
+
destroyWireframeMesh(mesh);
|
|
3142
|
+
_this.getEditorRenderPass(composition.renderFrame).removeMesh(mesh);
|
|
3143
|
+
}
|
|
3144
|
+
});
|
|
3145
|
+
} else {
|
|
3146
|
+
var wireframeMesh = this.wireframeMesh;
|
|
3147
|
+
if (wireframeMesh && !wireframeMesh.isDestroyed) {
|
|
3148
|
+
destroyWireframeMesh(wireframeMesh);
|
|
3149
|
+
this.getEditorRenderPass(composition.renderFrame).removeMesh(wireframeMesh);
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
var arr = composition.loaderData.gizmoItems;
|
|
3153
|
+
var index = arr.indexOf(this.item);
|
|
3154
|
+
if (index > -1) {
|
|
3155
|
+
arr.splice(index, 1);
|
|
3156
|
+
}
|
|
3157
|
+
};
|
|
3073
3158
|
_proto.render = function render(renderer) {
|
|
3074
3159
|
// The material of the 3D plugin is updated during the render phase. In order to obtain the correct value, it is kept consistent here.
|
|
3075
3160
|
if (this.subType === exports.GizmoSubType.modelWireframe) {
|
|
@@ -3274,7 +3359,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3274
3359
|
}
|
|
3275
3360
|
return result;
|
|
3276
3361
|
};
|
|
3277
|
-
_proto.createModelContent = function createModelContent(item
|
|
3362
|
+
_proto.createModelContent = function createModelContent(item) {
|
|
3278
3363
|
var _item_composition;
|
|
3279
3364
|
var modelComponent = item.getComponent(EFFECTS.RendererComponent);
|
|
3280
3365
|
//@ts-expect-error TODO 和 3D 类型解耦
|
|
@@ -3291,10 +3376,10 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3291
3376
|
});
|
|
3292
3377
|
var mesh = this.wireframeMesh = createModeWireframe(engine, originMesh, this.color);
|
|
3293
3378
|
this.wireframeMeshes.push(mesh);
|
|
3294
|
-
|
|
3379
|
+
this.meshes.push(mesh);
|
|
3295
3380
|
}
|
|
3296
3381
|
};
|
|
3297
|
-
_proto.createParticleContent = function createParticleContent(item
|
|
3382
|
+
_proto.createParticleContent = function createParticleContent(item) {
|
|
3298
3383
|
var _this_item_composition;
|
|
3299
3384
|
var shape = item.props.content.shape;
|
|
3300
3385
|
var engine = (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderer.engine;
|
|
@@ -3304,14 +3389,13 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3304
3389
|
var mesh = this.mesh = createMeshFromShape(engine, shape, {
|
|
3305
3390
|
color: this.color
|
|
3306
3391
|
});
|
|
3307
|
-
|
|
3392
|
+
this.meshes.push(mesh);
|
|
3308
3393
|
}
|
|
3309
3394
|
};
|
|
3310
3395
|
/**
|
|
3311
3396
|
* 创建 BoundingBox 几何体模型
|
|
3312
3397
|
* @param item - VFXItem
|
|
3313
|
-
|
|
3314
|
-
*/ _proto.createBoundingBoxContent = function createBoundingBoxContent(item, meshesToAdd) {
|
|
3398
|
+
*/ _proto.createBoundingBoxContent = function createBoundingBoxContent(item) {
|
|
3315
3399
|
var _gizmoItem_composition;
|
|
3316
3400
|
var gizmoItem = this.item;
|
|
3317
3401
|
var shape = {
|
|
@@ -3329,15 +3413,14 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3329
3413
|
color: this.color,
|
|
3330
3414
|
depthTest: this.depthTest
|
|
3331
3415
|
});
|
|
3332
|
-
|
|
3416
|
+
this.meshes.push(mesh);
|
|
3333
3417
|
}
|
|
3334
3418
|
};
|
|
3335
3419
|
/**
|
|
3336
3420
|
* 创建基础几何体模型
|
|
3337
3421
|
* @param item - VFXItem
|
|
3338
|
-
* @param meshesToAdd - 插件缓存的 Mesh 数组
|
|
3339
3422
|
* @param subType - GizmoSubType 类型
|
|
3340
|
-
*/ _proto.createBasicContent = function createBasicContent(item,
|
|
3423
|
+
*/ _proto.createBasicContent = function createBasicContent(item, subType, iconTextures) {
|
|
3341
3424
|
var _gizmoItem_composition;
|
|
3342
3425
|
var gizmoItem = this.item;
|
|
3343
3426
|
var options = {
|
|
@@ -3350,15 +3433,14 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3350
3433
|
EFFECTS.assertExist(engine);
|
|
3351
3434
|
var mesh = this.mesh = createMeshFromSubType(engine, subType, this.boundingMap, iconTextures, options);
|
|
3352
3435
|
this.targetItem = item;
|
|
3353
|
-
|
|
3436
|
+
this.meshes.push(mesh);
|
|
3354
3437
|
};
|
|
3355
3438
|
/**
|
|
3356
3439
|
* 创建组合几何体模型
|
|
3357
3440
|
* @param item - VFXItem
|
|
3358
|
-
* @param meshesToAdd - 插件缓存的 Mesh 数组
|
|
3359
3441
|
* @param subType - GizmoSubType 类型
|
|
3360
3442
|
* @param iconTextures - XYZ 图标纹理(viewHelper 专用)
|
|
3361
|
-
*/ _proto.createCombinationContent = function createCombinationContent(item,
|
|
3443
|
+
*/ _proto.createCombinationContent = function createCombinationContent(item, subType, iconTextures) {
|
|
3362
3444
|
var _gizmoItem_composition;
|
|
3363
3445
|
var gizmoItem = this.item;
|
|
3364
3446
|
var options = {
|
|
@@ -3370,7 +3452,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3370
3452
|
this.contents = createMeshFromSubType(engine, subType, this.boundingMap, iconTextures, options);
|
|
3371
3453
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.contents.keys()), _step; !(_step = _iterator()).done;){
|
|
3372
3454
|
var mesh = _step.value;
|
|
3373
|
-
|
|
3455
|
+
this.meshes.push(mesh);
|
|
3374
3456
|
}
|
|
3375
3457
|
this.targetItem = item;
|
|
3376
3458
|
};
|
|
@@ -3398,6 +3480,48 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
|
|
|
3398
3480
|
item.transform = new EFFECTS.Transform(data.transform);
|
|
3399
3481
|
}
|
|
3400
3482
|
};
|
|
3483
|
+
_proto.getBehindRenderPass = function getBehindRenderPass(pipeline) {
|
|
3484
|
+
var rp = pipeline.renderPasses.find(function(renderPass) {
|
|
3485
|
+
return renderPass.name === behindRenderPassName;
|
|
3486
|
+
});
|
|
3487
|
+
if (!rp) {
|
|
3488
|
+
rp = new EFFECTS.RenderPass(pipeline.renderer, {
|
|
3489
|
+
name: behindRenderPassName,
|
|
3490
|
+
priority: EFFECTS.RenderPassPriorityPostprocess + EFFECTS.RenderPassPriorityPostprocess,
|
|
3491
|
+
clearAction: {
|
|
3492
|
+
depthAction: EFFECTS.TextureLoadAction.clear
|
|
3493
|
+
}
|
|
3494
|
+
});
|
|
3495
|
+
pipeline.addRenderPass(rp);
|
|
3496
|
+
}
|
|
3497
|
+
return rp;
|
|
3498
|
+
};
|
|
3499
|
+
_proto.getEditorRenderPass = function getEditorRenderPass(pipeline) {
|
|
3500
|
+
var rp = pipeline.renderPasses.find(function(renderPass) {
|
|
3501
|
+
return renderPass.name === editorRenderPassName;
|
|
3502
|
+
});
|
|
3503
|
+
if (!rp) {
|
|
3504
|
+
rp = new EFFECTS.RenderPass(pipeline.renderer, {
|
|
3505
|
+
name: editorRenderPassName,
|
|
3506
|
+
priority: EFFECTS.RenderPassPriorityPostprocess + 2
|
|
3507
|
+
});
|
|
3508
|
+
pipeline.addRenderPass(rp);
|
|
3509
|
+
}
|
|
3510
|
+
return rp;
|
|
3511
|
+
};
|
|
3512
|
+
_proto.getFrontRenderPass = function getFrontRenderPass(pipeline) {
|
|
3513
|
+
var rp = pipeline.renderPasses.find(function(renderPass) {
|
|
3514
|
+
return renderPass.name === frontRenderPassName;
|
|
3515
|
+
});
|
|
3516
|
+
if (!rp) {
|
|
3517
|
+
rp = new EFFECTS.RenderPass(pipeline.renderer, {
|
|
3518
|
+
name: frontRenderPassName,
|
|
3519
|
+
priority: EFFECTS.RenderPassPriorityPrepare + 2
|
|
3520
|
+
});
|
|
3521
|
+
pipeline.addRenderPass(rp);
|
|
3522
|
+
}
|
|
3523
|
+
return rp;
|
|
3524
|
+
};
|
|
3401
3525
|
return GizmoComponent;
|
|
3402
3526
|
}(EFFECTS.RendererComponent);
|
|
3403
3527
|
__decorate([
|
|
@@ -3412,9 +3536,6 @@ exports.CoordinateSpace = void 0;
|
|
|
3412
3536
|
CoordinateSpace[CoordinateSpace["World"] = 1] = "World";
|
|
3413
3537
|
})(exports.CoordinateSpace || (exports.CoordinateSpace = {}));
|
|
3414
3538
|
|
|
3415
|
-
var editorRenderPassName = "editor-gizmo";
|
|
3416
|
-
var frontRenderPassName = "front-gizmo";
|
|
3417
|
-
var behindRenderPassName = "behind-gizmo";
|
|
3418
3539
|
var iconImages = new Map();
|
|
3419
3540
|
var iconTextures = new Map();
|
|
3420
3541
|
var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
|
|
@@ -3422,8 +3543,6 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
3422
3543
|
function EditorGizmoPlugin() {
|
|
3423
3544
|
var _this;
|
|
3424
3545
|
_this = AbstractPlugin.apply(this, arguments) || this;
|
|
3425
|
-
_this.meshToAdd = [];
|
|
3426
|
-
_this.meshToRemove = [];
|
|
3427
3546
|
_this.order = 1001;
|
|
3428
3547
|
return _this;
|
|
3429
3548
|
}
|
|
@@ -3452,182 +3571,6 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
3452
3571
|
composition.loaderData.gizmoTarget = targetMap;
|
|
3453
3572
|
composition.loaderData.gizmoItems = [];
|
|
3454
3573
|
};
|
|
3455
|
-
// override onCompositionItemLifeBegin (composition: Composition, item: VFXItem<any>) {
|
|
3456
|
-
// if (item.type === '7') {
|
|
3457
|
-
// return;
|
|
3458
|
-
// }
|
|
3459
|
-
// const gizmoVFXItemList: GizmoVFXItem[] = composition.loaderData.gizmoTarget[item.id];
|
|
3460
|
-
// if (gizmoVFXItemList && gizmoVFXItemList.length > 0) {
|
|
3461
|
-
// for (const gizmoVFXItem of gizmoVFXItemList) {
|
|
3462
|
-
// switch (gizmoVFXItem.subType) {
|
|
3463
|
-
// case GizmoSubType.particleEmitter:
|
|
3464
|
-
// gizmoVFXItem.createParticleContent(item, this.meshToAdd);
|
|
3465
|
-
// break;
|
|
3466
|
-
// case GizmoSubType.modelWireframe:
|
|
3467
|
-
// gizmoVFXItem.createModelContent(item, this.meshToAdd);
|
|
3468
|
-
// break;
|
|
3469
|
-
// case GizmoSubType.box:
|
|
3470
|
-
// case GizmoSubType.sphere:
|
|
3471
|
-
// case GizmoSubType.cylinder:
|
|
3472
|
-
// case GizmoSubType.cone:
|
|
3473
|
-
// case GizmoSubType.torus:
|
|
3474
|
-
// case GizmoSubType.sprite:
|
|
3475
|
-
// case GizmoSubType.frustum:
|
|
3476
|
-
// case GizmoSubType.directionLight:
|
|
3477
|
-
// case GizmoSubType.pointLight:
|
|
3478
|
-
// case GizmoSubType.spotLight:
|
|
3479
|
-
// case GizmoSubType.floorGrid:
|
|
3480
|
-
// gizmoVFXItem.createBasicContent(item, this.meshToAdd, gizmoVFXItem.subType);
|
|
3481
|
-
// break;
|
|
3482
|
-
// case GizmoSubType.camera:
|
|
3483
|
-
// case GizmoSubType.light:
|
|
3484
|
-
// gizmoVFXItem.createBasicContent(item, this.meshToAdd, gizmoVFXItem.subType, iconTextures);
|
|
3485
|
-
// break;
|
|
3486
|
-
// case GizmoSubType.rotation:
|
|
3487
|
-
// case GizmoSubType.scale:
|
|
3488
|
-
// case GizmoSubType.translation:
|
|
3489
|
-
// gizmoVFXItem.createCombinationContent(item, this.meshToAdd, gizmoVFXItem.subType);
|
|
3490
|
-
// break;
|
|
3491
|
-
// case GizmoSubType.viewHelper:
|
|
3492
|
-
// gizmoVFXItem.createCombinationContent(item, this.meshToAdd, gizmoVFXItem.subType, iconTextures);
|
|
3493
|
-
// break;
|
|
3494
|
-
// case GizmoSubType.boundingBox:
|
|
3495
|
-
// gizmoVFXItem.createBoundingBoxContent(item, this.meshToAdd);
|
|
3496
|
-
// break;
|
|
3497
|
-
// default:
|
|
3498
|
-
// break;
|
|
3499
|
-
// }
|
|
3500
|
-
// }
|
|
3501
|
-
// }
|
|
3502
|
-
// if (item.type === GizmoVFXItemType) {
|
|
3503
|
-
// composition.loaderData.gizmoItems.push(item);
|
|
3504
|
-
// }
|
|
3505
|
-
// }
|
|
3506
|
-
_proto.onCompositionItemRemoved = function onCompositionItemRemoved(composition, item) {
|
|
3507
|
-
var _this = this;
|
|
3508
|
-
if (item.type === GizmoVFXItemType) {
|
|
3509
|
-
this.removeGizmoItem(composition, item);
|
|
3510
|
-
} else {
|
|
3511
|
-
var gizmoVFXItemList = composition.loaderData.gizmoTarget[item.id];
|
|
3512
|
-
if (gizmoVFXItemList && gizmoVFXItemList.length > 0) {
|
|
3513
|
-
gizmoVFXItemList.forEach(function(gizmoVFXItem) {
|
|
3514
|
-
_this.removeGizmoItem(composition, gizmoVFXItem);
|
|
3515
|
-
});
|
|
3516
|
-
}
|
|
3517
|
-
}
|
|
3518
|
-
};
|
|
3519
|
-
_proto.removeGizmoItem = function removeGizmoItem(composition, gizmoVFXItem) {
|
|
3520
|
-
var _this = this;
|
|
3521
|
-
var gizmoMesh = gizmoVFXItem.getComponent(exports.GizmoComponent).mesh;
|
|
3522
|
-
if (gizmoMesh && !gizmoMesh.isDestroyed) {
|
|
3523
|
-
gizmoMesh.dispose();
|
|
3524
|
-
if (gizmoMesh.name === exports.GeometryType.FloorGrid.toString() || gizmoMesh.name === "Box") {
|
|
3525
|
-
this.getFrontRenderPass(composition.renderFrame).removeMesh(gizmoMesh);
|
|
3526
|
-
} else {
|
|
3527
|
-
this.getEditorRenderPass(composition.renderFrame).removeMesh(gizmoMesh);
|
|
3528
|
-
}
|
|
3529
|
-
}
|
|
3530
|
-
if (gizmoVFXItem.getComponent(exports.GizmoComponent).contents) {
|
|
3531
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(gizmoVFXItem.getComponent(exports.GizmoComponent).contents), _step; !(_step = _iterator()).done;){
|
|
3532
|
-
var _step_value = _step.value, mesh = _step_value[0];
|
|
3533
|
-
if (!mesh.isDestroyed) {
|
|
3534
|
-
mesh.dispose();
|
|
3535
|
-
if (mesh.name === "translation" || mesh.name === "scale" || mesh.name === "rotation") {
|
|
3536
|
-
this.getBehindRenderPass(composition.renderFrame).removeMesh(mesh);
|
|
3537
|
-
} else {
|
|
3538
|
-
this.getEditorRenderPass(composition.renderFrame).removeMesh(mesh);
|
|
3539
|
-
}
|
|
3540
|
-
}
|
|
3541
|
-
}
|
|
3542
|
-
}
|
|
3543
|
-
var gizmoComponent = gizmoVFXItem.getComponent(exports.GizmoComponent);
|
|
3544
|
-
if (gizmoComponent && gizmoComponent.wireframeMeshes.length > 0) {
|
|
3545
|
-
gizmoComponent.wireframeMeshes.forEach(function(mesh) {
|
|
3546
|
-
if (!mesh.isDestroyed) {
|
|
3547
|
-
destroyWireframeMesh(mesh);
|
|
3548
|
-
_this.getEditorRenderPass(composition.renderFrame).removeMesh(mesh);
|
|
3549
|
-
}
|
|
3550
|
-
});
|
|
3551
|
-
} else {
|
|
3552
|
-
var wireframeMesh = gizmoVFXItem.getComponent(exports.GizmoComponent).wireframeMesh;
|
|
3553
|
-
if (wireframeMesh && !wireframeMesh.isDestroyed) {
|
|
3554
|
-
destroyWireframeMesh(wireframeMesh);
|
|
3555
|
-
this.getEditorRenderPass(composition.renderFrame).removeMesh(wireframeMesh);
|
|
3556
|
-
}
|
|
3557
|
-
}
|
|
3558
|
-
var arr = composition.loaderData.gizmoItems;
|
|
3559
|
-
var index = arr.indexOf(gizmoVFXItem);
|
|
3560
|
-
if (index > -1) {
|
|
3561
|
-
arr.splice(index, 1);
|
|
3562
|
-
}
|
|
3563
|
-
};
|
|
3564
|
-
_proto.prepareRenderFrame = function prepareRenderFrame(composition, renderFrame) {
|
|
3565
|
-
var _this = this;
|
|
3566
|
-
this.meshToAdd.forEach(function(mesh) {
|
|
3567
|
-
if (mesh.name === exports.GeometryType.FloorGrid.toString() || mesh.name === "Box") {
|
|
3568
|
-
_this.getFrontRenderPass(renderFrame).addMesh(mesh);
|
|
3569
|
-
} else if (mesh.name === "translation" || mesh.name === "scale" || mesh.name === "rotation") {
|
|
3570
|
-
_this.getBehindRenderPass(renderFrame).addMesh(mesh);
|
|
3571
|
-
} else {
|
|
3572
|
-
_this.getEditorRenderPass(renderFrame).addMesh(mesh);
|
|
3573
|
-
}
|
|
3574
|
-
});
|
|
3575
|
-
this.meshToRemove.forEach(function(mesh) {
|
|
3576
|
-
if (mesh.name === exports.GeometryType.FloorGrid.toString() || mesh.name === "Box") {
|
|
3577
|
-
_this.getFrontRenderPass(renderFrame).removeMesh(mesh);
|
|
3578
|
-
} else if (mesh.name === "translation" || mesh.name === "scale" || mesh.name === "rotation") {
|
|
3579
|
-
_this.getBehindRenderPass(renderFrame).removeMesh(mesh);
|
|
3580
|
-
} else {
|
|
3581
|
-
_this.getEditorRenderPass(renderFrame).removeMesh(mesh);
|
|
3582
|
-
}
|
|
3583
|
-
EFFECTS.removeItem(_this.meshToAdd, mesh);
|
|
3584
|
-
});
|
|
3585
|
-
this.meshToRemove.length = 0;
|
|
3586
|
-
// composition.loaderData.gizmoItems.forEach((item: GizmoVFXItem) => item.updateRenderData());
|
|
3587
|
-
return false;
|
|
3588
|
-
};
|
|
3589
|
-
_proto.getBehindRenderPass = function getBehindRenderPass(pipeline) {
|
|
3590
|
-
var rp = pipeline.renderPasses.find(function(renderPass) {
|
|
3591
|
-
return renderPass.name === behindRenderPassName;
|
|
3592
|
-
});
|
|
3593
|
-
if (!rp) {
|
|
3594
|
-
rp = new EFFECTS.RenderPass(pipeline.renderer, {
|
|
3595
|
-
name: behindRenderPassName,
|
|
3596
|
-
priority: EFFECTS.RenderPassPriorityPostprocess + EFFECTS.RenderPassPriorityPostprocess,
|
|
3597
|
-
clearAction: {
|
|
3598
|
-
depthAction: EFFECTS.TextureLoadAction.clear
|
|
3599
|
-
}
|
|
3600
|
-
});
|
|
3601
|
-
pipeline.addRenderPass(rp);
|
|
3602
|
-
}
|
|
3603
|
-
return rp;
|
|
3604
|
-
};
|
|
3605
|
-
_proto.getEditorRenderPass = function getEditorRenderPass(pipeline) {
|
|
3606
|
-
var rp = pipeline.renderPasses.find(function(renderPass) {
|
|
3607
|
-
return renderPass.name === editorRenderPassName;
|
|
3608
|
-
});
|
|
3609
|
-
if (!rp) {
|
|
3610
|
-
rp = new EFFECTS.RenderPass(pipeline.renderer, {
|
|
3611
|
-
name: editorRenderPassName,
|
|
3612
|
-
priority: EFFECTS.RenderPassPriorityPostprocess + 2
|
|
3613
|
-
});
|
|
3614
|
-
pipeline.addRenderPass(rp);
|
|
3615
|
-
}
|
|
3616
|
-
return rp;
|
|
3617
|
-
};
|
|
3618
|
-
_proto.getFrontRenderPass = function getFrontRenderPass(pipeline) {
|
|
3619
|
-
var rp = pipeline.renderPasses.find(function(renderPass) {
|
|
3620
|
-
return renderPass.name === frontRenderPassName;
|
|
3621
|
-
});
|
|
3622
|
-
if (!rp) {
|
|
3623
|
-
rp = new EFFECTS.RenderPass(pipeline.renderer, {
|
|
3624
|
-
name: frontRenderPassName,
|
|
3625
|
-
priority: EFFECTS.RenderPassPriorityPrepare + 2
|
|
3626
|
-
});
|
|
3627
|
-
pipeline.addRenderPass(rp);
|
|
3628
|
-
}
|
|
3629
|
-
return rp;
|
|
3630
|
-
};
|
|
3631
3574
|
EditorGizmoPlugin.prepareResource = function prepareResource(scene) {
|
|
3632
3575
|
return _async_to_generator(function() {
|
|
3633
3576
|
var _iterator, _step, _step_value, name, data, _, _tmp;
|
|
@@ -3679,7 +3622,7 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
3679
3622
|
EFFECTS.registerPlugin("editor-gizmo", EditorGizmoPlugin, EFFECTS.VFXItem);
|
|
3680
3623
|
/**
|
|
3681
3624
|
* 插件版本号
|
|
3682
|
-
*/ var version = "2.
|
|
3625
|
+
*/ var version = "2.8.0-alpha.0";
|
|
3683
3626
|
EFFECTS.logger.info("Plugin editor gizmo version: " + version + ".");
|
|
3684
3627
|
if (version !== EFFECTS__namespace.version) {
|
|
3685
3628
|
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!");
|