fl-web-component 1.2.1 → 1.2.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/README.md +4 -0
- package/dist/fl-web-component.common.js +93 -95
- package/dist/fl-web-component.css +1 -1
- package/package.json +1 -1
- package/packages/components/com-flcanvas/index.vue +5 -4
- package/packages/components/com-graphics/index.vue +16 -48
- package/src/utils/flgltf-parser.js +7 -5
- package/src/utils/instance-parser.js +18 -12
- package/src/utils/mock.js +0 -284913
|
@@ -293,7 +293,7 @@ function draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity) {
|
|
|
293
293
|
if (Array.isArray(color) && color.length) {
|
|
294
294
|
colors = color;
|
|
295
295
|
opacity = colors[3];
|
|
296
|
-
} else if (color) {
|
|
296
|
+
} else if (typeof color === 'string') {
|
|
297
297
|
colors = color.split(',');
|
|
298
298
|
opacity = colors[3];
|
|
299
299
|
} else {
|
|
@@ -302,19 +302,25 @@ function draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity) {
|
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
// 使用自定义材质或创建标准材质(默认参数配置)
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
let materialOptions = {
|
|
306
|
+
userData: {
|
|
307
|
+
nColor: nColor
|
|
308
|
+
? new THREE.Color(nColor)
|
|
309
|
+
: new THREE.Color(`rgb(${colors[0]}, ${colors[1]}, ${colors[2]})`),
|
|
310
|
+
nOpacity: nOpacity ? nOpacity : opacity,
|
|
311
|
+
},
|
|
312
|
+
side: THREE.DoubleSide,
|
|
313
|
+
transparent: true, // 着色器中需要设置透明度
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
customMaterial && Object.assign(customMaterial, materialOptions)
|
|
317
|
+
|
|
318
|
+
material = customMaterial ||
|
|
307
319
|
new THREE.MeshStandardMaterial({
|
|
320
|
+
...materialOptions,
|
|
308
321
|
roughness: 0.8,
|
|
309
322
|
envMapIntensity: 0.5, // 调低环境贴图的强度
|
|
310
|
-
|
|
311
|
-
userData: {
|
|
312
|
-
nColor: nColor
|
|
313
|
-
? new THREE.Color(nColor)
|
|
314
|
-
: new THREE.Color(`rgb(${colors[0]}, ${colors[1]}, ${colors[2]})`),
|
|
315
|
-
nOpacity: nOpacity ? nOpacity : opacity,
|
|
316
|
-
},
|
|
317
|
-
transparent: true, // 着色器中需要设置透明度
|
|
323
|
+
// wireframe: true
|
|
318
324
|
});
|
|
319
325
|
|
|
320
326
|
// 为每个实例存储透明度(opacity)
|
|
@@ -359,9 +365,9 @@ function draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity) {
|
|
|
359
365
|
}
|
|
360
366
|
mesh = new THREE.InstancedMesh(geometry, material, instanceCount);
|
|
361
367
|
mesh.userData.drawObjectId = instanceName;
|
|
368
|
+
mesh.userData.is3D = geom.type == GEOM_TYPES.geom_3d || geom.type == GEOM_TYPES.geom_3d_obj;
|
|
362
369
|
|
|
363
370
|
// mesh.material = material;
|
|
364
|
-
|
|
365
371
|
return mesh;
|
|
366
372
|
}
|
|
367
373
|
|