fl-web-component 1.2.9 → 1.2.10
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/package.json
CHANGED
|
@@ -99,7 +99,17 @@ function handleInstancedMeshModel(
|
|
|
99
99
|
// m4.setPosition(new THREE.Vector3(9999999, 9999999, 9999999)); // TODO 临时隐藏方案
|
|
100
100
|
meshMatrix.elements = item.matrix.val;
|
|
101
101
|
geomMatrix.elements = mesh.matrix.val;
|
|
102
|
+
|
|
103
|
+
const { points } = mesh;
|
|
104
|
+
if(isTextType(mesh.type)){
|
|
105
|
+
const positionMatrix = new THREE.Matrix4();
|
|
106
|
+
const alignMatrix = new THREE.Matrix4();
|
|
107
|
+
positionMatrix.identity().makeTranslation(points[0], points[1], points[2]);
|
|
108
|
+
alignMatrix.identity().makeTranslation(-(mesh.prop.fontsize / 2.5), -(mesh.prop.fontsize / 2.5), 0);
|
|
109
|
+
geomMatrix.multiply(positionMatrix).multiply(alignMatrix);
|
|
110
|
+
}
|
|
102
111
|
m4.multiplyMatrices(meshMatrix, geomMatrix);
|
|
112
|
+
|
|
103
113
|
model.setMatrixAt(index, m4);
|
|
104
114
|
const copyMatrix = new THREE.Matrix4().copy(m4);
|
|
105
115
|
model.userData.copyMatrix = copyMatrix;
|
|
@@ -186,12 +196,7 @@ function drawModel(geom, instanceName, instanceCount, nColor, nOpacity) {
|
|
|
186
196
|
if (geom.type == GEOM_TYPES.geom_2d || geom.type == GEOM_TYPES.geom_2d_others) {
|
|
187
197
|
model = draw2Dmodel(geom, instanceName, instanceCount); // TODO 该类型调试中
|
|
188
198
|
// 处理二维文本类型
|
|
189
|
-
} else if (
|
|
190
|
-
geom.type == GEOM_TYPES.geom_2d_text ||
|
|
191
|
-
geom.type == GEOM_TYPES.geom_2d_mtext ||
|
|
192
|
-
geom.type == GEOM_TYPES.geom_3d_text ||
|
|
193
|
-
geom.type == GEOM_TYPES.geom_3d_mtext
|
|
194
|
-
) {
|
|
199
|
+
} else if (isTextType(geom.type)) {
|
|
195
200
|
model = drawText(geom, instanceName, instanceCount);
|
|
196
201
|
// 处理各种曲线类型(圆形、圆弧、椭圆、椭圆弧)
|
|
197
202
|
} else if (
|
|
@@ -208,6 +213,19 @@ function drawModel(geom, instanceName, instanceCount, nColor, nOpacity) {
|
|
|
208
213
|
return model;
|
|
209
214
|
}
|
|
210
215
|
|
|
216
|
+
/**
|
|
217
|
+
* 判断几何类型是否为文本类型
|
|
218
|
+
* @param {number} type - 几何类型枚举值,参考GEOM_TYPES中的定义
|
|
219
|
+
* @returns {boolean} 是否为文本类型(2D/3D 单行或多行文本)
|
|
220
|
+
*/
|
|
221
|
+
function isTextType(type){
|
|
222
|
+
return type == GEOM_TYPES.geom_2d_text ||
|
|
223
|
+
type == GEOM_TYPES.geom_2d_mtext ||
|
|
224
|
+
type == GEOM_TYPES.geom_3d_text ||
|
|
225
|
+
type == GEOM_TYPES.geom_3d_mtext
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
|
|
211
229
|
/**
|
|
212
230
|
* 绘制曲线
|
|
213
231
|
*
|
|
@@ -275,7 +293,7 @@ function drawCurves(geom, instanceName, instanceCount) {
|
|
|
275
293
|
*/
|
|
276
294
|
function draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity) {
|
|
277
295
|
// 解构几何数据中的自定义几何体和材质
|
|
278
|
-
const { geometry: customGeometry, material: customMaterial, triangles, points, normals } = geom;
|
|
296
|
+
const { geometry: customGeometry, material: customMaterial, triangles, points, normals, prop } = geom;
|
|
279
297
|
// 使用自定义几何体或创建新的缓冲几何体
|
|
280
298
|
const geometry = customGeometry || new THREE.BufferGeometry();
|
|
281
299
|
|
|
@@ -295,7 +313,7 @@ function draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity) {
|
|
|
295
313
|
const normal = new Float32Array(normals);
|
|
296
314
|
geometry.setAttribute('normal', new THREE.BufferAttribute(normal, 3));
|
|
297
315
|
}
|
|
298
|
-
const { color } =
|
|
316
|
+
const { color } = prop;
|
|
299
317
|
let material, mesh, colors, opacity;
|
|
300
318
|
if (Array.isArray(color) && color.length) {
|
|
301
319
|
colors = color;
|
|
@@ -460,10 +478,10 @@ function drawText(geom, instanceName, instanceCount) {
|
|
|
460
478
|
);
|
|
461
479
|
|
|
462
480
|
// 创建平移矩阵并应用
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
mesh.
|
|
481
|
+
// const matrix = new THREE.Matrix4();
|
|
482
|
+
// matrix.identity().makeTranslation(points[0], points[1], points[2]);
|
|
483
|
+
// mesh.applyMatrix4(matrix);
|
|
484
|
+
// points && mesh.position.set(points[0], points[1], points[2]);
|
|
467
485
|
|
|
468
486
|
// if (stageId == STAGE_MODEL_TYPE.PID) {
|
|
469
487
|
// mesh.translateX(-(fontsize / 2));
|
|
@@ -475,8 +493,8 @@ function drawText(geom, instanceName, instanceCount) {
|
|
|
475
493
|
// mesh.rotateY(rotate);
|
|
476
494
|
// }
|
|
477
495
|
// mesh.rotateX(-Math.PI / 2);
|
|
478
|
-
mesh.translateX(-(fontsize / 2.5));
|
|
479
|
-
mesh.translateY(-(fontsize / 2.5));
|
|
496
|
+
// mesh.translateX(-(fontsize / 2.5));
|
|
497
|
+
// mesh.translateY(-(fontsize / 2.5));
|
|
480
498
|
|
|
481
499
|
mesh.userData.instanceName = instanceName;
|
|
482
500
|
return mesh;
|
package/src/assets/test.png
DELETED
|
Binary file
|
package/src/assets/worker.glb
DELETED
|
Binary file
|