Procházet zdrojové kódy

feat: 新增打包平台

bill před 4 týdny
rodič
revize
5a75045615

+ 2 - 2
package.json

@@ -5,8 +5,8 @@
   "type": "module",
   "type": "module",
   "scripts": {
   "scripts": {
     "dev:fuse": "vite --mode=criminaldev",
     "dev:fuse": "vite --mode=criminaldev",
-    "build:fusetest": "vite build --mode=firetest && vite build --mode=criminaltest",
-    "build:fuse": "vite build --mode=fire && vite build --mode=criminal",
+    "build:fusetest": "vite build --mode=firetest && vite build --mode=criminaltest && vite build --mode=cjzfiretest && vite build --mode=xmfiretest",
+    "build:fuse": "vite build --mode=fire && vite build --mode=criminal && vite build --mode=cjzfire && vite build --mode=xmfire",
 
 
     "dev:hx": "vite --mode=hxdev",
     "dev:hx": "vite --mode=hxdev",
     "build:hx": "vite build --mode=hx",
     "build:hx": "vite build --mode=hx",

+ 15 - 0
profile/.env.cjzfire

@@ -0,0 +1,15 @@
+VITE_PRIMARY='#D8000A'
+VITE_TITLE='绘图'
+VITE_ENTRY='/example/fuse/enter-mix.ts'
+VITE_ENTRY_EXAMPLE='./main.ts'
+VITE_MESH_OSS='https://4dkk.4dage.com/'
+VITE_MESH_API='https://www.4dkankan.com/'
+VITE_CLOUD_API='https://laser.4dkankan.com/backend/'
+VITE_FUSE_API='https://mix3d.4dkankan.com/'
+VITE_MESH_VIEW='./static/kankan.html?m={m}&lang=zh&host=https://4dkk.4dage.com/v4/www&server=https://www.4dkankan.com&oss=https://4dkk.4dage.com/'
+VITE_CLOUD_VIEW='https://laser.4dkankan.com/index.html?m={m}&lang=zh'
+VITE_FUSE_VIEW='https://mix3d.4dkankan.com/'
+VITE_LOGIN_VIEW='https://test-mix3d.4dkankan.com/fire/?redirect={redirect}#login'
+
+VITE_BUILD_DIR="cjzfire"
+VITE_ICO="./icos/logo_big.ico"

+ 18 - 0
profile/.env.cjzfiretest

@@ -0,0 +1,18 @@
+VITE_PRIMARY='#D8000A'
+VITE_TITLE='绘图'
+VITE_ENTRY='/example/fuse/enter-mix.ts'
+VITE_ENTRY_EXAMPLE='./main.ts'
+
+VITE_OSS_ROOT="https://4dkk.4dage.com/"
+VITE_MESH_OSS='https://4dkk.4dage.com/'
+VITE_MESH_API='https://test.4dkankan.com/'
+VITE_CLOUD_API='https://uat-laser.4dkankan.com/uat/'
+VITE_FUSE_API='https://test-mix3d.4dkankan.com/'
+
+VITE_MESH_VIEW='./static/kankan.html?m={m}&lang=zh&host=https://4dkk.4dage.com/v4-test/www&server=https://test.4dkankan.com&oss=https://4dkk.4dage.com/'
+VITE_CLOUD_VIEW='https://uat-laser.4dkankan.com/uat/index.html?m={m}&lang=zh'
+VITE_FUSE_VIEW='https://test-mix3d.4dkankan.com/'
+VITE_LOGIN_VIEW='https://test-mix3d.4dkankan.com/fire/?redirect={redirect}#login'
+
+VITE_BUILD_DIR="cjzfire"
+VITE_ICO="./icos/logo_big.ico"

+ 15 - 0
profile/.env.xmfire

@@ -0,0 +1,15 @@
+VITE_PRIMARY='#409eff'
+VITE_TITLE='绘图'
+VITE_ENTRY='/example/fuse/enter-mix.ts'
+VITE_ENTRY_EXAMPLE='./main.ts'
+VITE_MESH_OSS='https://4dkk.4dage.com/'
+VITE_MESH_API='https://www.4dkankan.com/'
+VITE_CLOUD_API='https://laser.4dkankan.com/backend/'
+VITE_FUSE_API='https://mix3d.4dkankan.com/'
+VITE_MESH_VIEW='./static/kankan.html?m={m}&lang=zh&host=https://4dkk.4dage.com/v4/www&server=https://www.4dkankan.com&oss=https://4dkk.4dage.com/'
+VITE_CLOUD_VIEW='https://laser.4dkankan.com/index.html?m={m}&lang=zh'
+VITE_FUSE_VIEW='https://mix3d.4dkankan.com/'
+VITE_LOGIN_VIEW='https://test-mix3d.4dkankan.com/fire/?redirect={redirect}#login'
+
+VITE_BUILD_DIR="xmfire"
+VITE_ICO="./icos/xmfire.ico"

+ 18 - 0
profile/.env.xmfiretest

@@ -0,0 +1,18 @@
+VITE_PRIMARY='#409eff'
+VITE_TITLE='绘图'
+VITE_ENTRY='/example/fuse/enter-mix.ts'
+VITE_ENTRY_EXAMPLE='./main.ts'
+
+VITE_OSS_ROOT="https://4dkk.4dage.com/"
+VITE_MESH_OSS='https://4dkk.4dage.com/'
+VITE_MESH_API='https://test.4dkankan.com/'
+VITE_CLOUD_API='https://uat-laser.4dkankan.com/uat/'
+VITE_FUSE_API='https://test-mix3d.4dkankan.com/'
+
+VITE_MESH_VIEW='./static/kankan.html?m={m}&lang=zh&host=https://4dkk.4dage.com/v4-test/www&server=https://test.4dkankan.com&oss=https://4dkk.4dage.com/'
+VITE_CLOUD_VIEW='https://uat-laser.4dkankan.com/uat/index.html?m={m}&lang=zh'
+VITE_FUSE_VIEW='https://test-mix3d.4dkankan.com/'
+VITE_LOGIN_VIEW='https://test-mix3d.4dkankan.com/fire/?redirect={redirect}#login'
+
+VITE_BUILD_DIR="xmfire"
+VITE_ICO="./icos/xmfire.ico"

binární
public/icos/logo_big.ico


binární
public/icos/xmfire.png


+ 0 - 25
src/core/renderer-three/components/line/material.ts

@@ -1,25 +0,0 @@
-import { MeshPhongMaterial, MeshPhongMaterialParameters, ShaderLib, UniformsUtils } from "three";
-
-export class StablePhongMaterial extends MeshPhongMaterial {
-  uniforms = {
-    ...UniformsUtils.clone(ShaderLib.phong.uniforms),
-    objectId: { value: 0 }
-  }
-  
-  constructor(options?: MeshPhongMaterialParameters) {
-    super(options)
-
-    // this.onBeforeCompile = shader => {
-    //   shader.uniforms.objectId = this.uniforms.objectId
-    //   shader.vertexShader = `
-    //     uniform float objectId;
-    //     ${shader.vertexShader}
-    //   `.replace(`#include <project_vertex>`, `
-    //       #include <project_vertex>
-    //       gl_Position.z += objectId * 0.0001;
-    //   `);
-
-    //   this.userData.shader = shader
-    // }
-  }
-}

+ 68 - 36
src/core/renderer-three/components/line/single-line.vue

@@ -6,11 +6,13 @@ import { getLinePoints } from "@/core/components/line/attach-server";
 import {
 import {
   BufferGeometry,
   BufferGeometry,
   Color,
   Color,
-  DoubleSide,
   ExtrudeGeometry,
   ExtrudeGeometry,
+  FrontSide,
   Group,
   Group,
   Mesh,
   Mesh,
+  MeshPhongMaterial,
   Shape,
   Shape,
+  Vector2,
 } from "three";
 } from "three";
 import { computed, onUnmounted, Ref, ref, watch, watchEffect } from "vue";
 import { computed, onUnmounted, Ref, ref, watch, watchEffect } from "vue";
 import { useDrawHook, useRender, useStageProps, useTree } from "../../hook/use-stage";
 import { useDrawHook, useRender, useStageProps, useTree } from "../../hook/use-stage";
@@ -20,7 +22,6 @@ import {
   useGetExtendPolygon,
   useGetExtendPolygon,
 } from "@/core/components/line/renderer/wall/view";
 } from "@/core/components/line/renderer/wall/view";
 import { BufferGeometryUtils } from "three/examples/jsm/Addons.js";
 import { BufferGeometryUtils } from "three/examples/jsm/Addons.js";
-import { StablePhongMaterial } from "./material";
 
 
 const props = defineProps<{
 const props = defineProps<{
   line: LineDataLine;
   line: LineDataLine;
@@ -34,7 +35,7 @@ const gd = useDrawHook(() => useGetDiffLineIconPolygons(props.line, points));
 const polygons = computed(() => gd.diff(polygon.value));
 const polygons = computed(() => gd.diff(polygon.value));
 const wallGeo = ref() as Ref<BufferGeometry>;
 const wallGeo = ref() as Ref<BufferGeometry>;
 const skirtingGeo = ref() as Ref<BufferGeometry>;
 const skirtingGeo = ref() as Ref<BufferGeometry>;
-const skirtingHeight = 20
+const skirtingHeight = 20;
 const sProps = useStageProps();
 const sProps = useStageProps();
 
 
 watch(
 watch(
@@ -42,72 +43,103 @@ watch(
   debounce(() => {
   debounce(() => {
     wallGeo.value && wallGeo.value.dispose();
     wallGeo.value && wallGeo.value.dispose();
     skirtingGeo.value && skirtingGeo.value.dispose();
     skirtingGeo.value && skirtingGeo.value.dispose();
+
     const polyGeos = polygons.value.map((poly) => {
     const polyGeos = polygons.value.map((poly) => {
-      const shape = new Shape();
-      shape.moveTo(poly[0].x, poly[0].y);
-      for (let i = 1; i < poly.length; i++) {
-        shape.lineTo(poly[i].x, poly[i].y);
-      }
-      shape.lineTo(poly[poly.length - 1].x, poly[poly.length - 1].y);
-      const wallGeo = new ExtrudeGeometry(shape, {
-        depth: sProps.value.height,
+      const wallShape = new Shape();
+      const center = new Vector2();
+      const vs = poly.map((p, ndx) => {
+        if (ndx === 0) {
+          wallShape.moveTo(p.x, p.y);
+        } else {
+          wallShape.lineTo(p.x, p.y);
+        }
+        const v = new Vector2(p.x, p.y);
+        center.add(v);
+        return v;
+      });
+      wallShape.closePath();
+      center.divideScalar(vs.length);
+
+      const skirtingShape = new Shape();
+      vs.forEach((v, ndx) => {
+        const p = v.clone().sub(center).multiplyScalar(1.1).add(center);
+        if (ndx === 0) {
+          skirtingShape.moveTo(p.x, p.y);
+        } else {
+          skirtingShape.lineTo(p.x, p.y);
+        }
+      });
+      skirtingShape.closePath();
+
+      const wallGeo = new ExtrudeGeometry(wallShape, {
+        depth: sProps.value.height - skirtingHeight,
         bevelEnabled: false,
         bevelEnabled: false,
         steps: 1,
         steps: 1,
       });
       });
-      const skirtingGeo = new ExtrudeGeometry(shape, {
+      const skirtingGeo = new ExtrudeGeometry(skirtingShape, {
         depth: skirtingHeight,
         depth: skirtingHeight,
         bevelEnabled: false,
         bevelEnabled: false,
         steps: 1,
         steps: 1,
       });
       });
-      return {wall: wallGeo, skirting: skirtingGeo};
+      return { wall: wallGeo, skirting: skirtingGeo };
     });
     });
 
 
-    wallGeo.value = BufferGeometryUtils.mergeGeometries(polyGeos.map(item => item.wall));
+    wallGeo.value = BufferGeometryUtils.mergeGeometries(
+      polyGeos.map((item) => item.wall)
+    );
     wallGeo.value.rotateX(Math.PI / 2).translate(0, sProps.value.height, 0);
     wallGeo.value.rotateX(Math.PI / 2).translate(0, sProps.value.height, 0);
 
 
-    skirtingGeo.value = BufferGeometryUtils.mergeGeometries(polyGeos.map(item => item.skirting));
+    skirtingGeo.value = BufferGeometryUtils.mergeGeometries(
+      polyGeos.map((item) => item.skirting)
+    );
     skirtingGeo.value.rotateX(Math.PI / 2).translate(0, skirtingHeight, 0);
     skirtingGeo.value.rotateX(Math.PI / 2).translate(0, skirtingHeight, 0);
 
 
     polyGeos.forEach((geo) => {
     polyGeos.forEach((geo) => {
-      geo.wall.dispose()
-      geo.skirting.dispose()
+      geo.wall.dispose();
+      geo.skirting.dispose();
     });
     });
   }),
   }),
   { immediate: true }
   { immediate: true }
 );
 );
 
 
-const material = new StablePhongMaterial({ side: DoubleSide });
-material.uniforms.objectId.value = props.data.lines.indexOf(props.line);
-
 const render = useRender();
 const render = useRender();
-watchEffect(() => {
-  // material.color = new Color(props.line.stroke);
-  material.color = new Color(0xffffff);
-  render();
-});
 
 
 const group = new Group();
 const group = new Group();
-const mesh = new Mesh(undefined, material);
-mesh.castShadow = true;
-mesh.receiveShadow = true;
+const wall = new Mesh(
+  undefined,
+  new MeshPhongMaterial({ side: FrontSide, color: 0xffffff })
+);
+wall.castShadow = true;
+wall.receiveShadow = true;
+
+const skirting = new Mesh(
+  undefined,
+  new MeshPhongMaterial({ side: FrontSide, color: 0xff0000 })
+);
+
 watchEffect(() => {
 watchEffect(() => {
-  mesh.geometry = wallGeo.value;
+  wall.geometry = wallGeo.value;
+  skirting.geometry = skirtingGeo.value;
   render();
   render();
 });
 });
 
 
-onUnmounted(() => {
-  material.dispose();
-  mesh.geometry?.dispose();
-});
-
 watchEffect(() => {
 watchEffect(() => {
   if (wallGeo.value) {
   if (wallGeo.value) {
-    group.add(mesh);
+    group.add(wall);
+    group.add(skirting);
   } else {
   } else {
-    group.remove(mesh);
+    group.remove(wall);
+    group.remove(skirting);
   }
   }
 });
 });
 
 
+onUnmounted(() => {
+  wall.material.dispose();
+  wall.geometry?.dispose();
+  skirting.material.dispose();
+  skirting.geometry?.dispose();
+});
+
 const tree = useTree();
 const tree = useTree();
 tree.value = group;
 tree.value = group;
 </script>
 </script>

+ 0 - 2
src/core/renderer-three/components/text/index.vue

@@ -4,7 +4,6 @@
 import {
 import {
   BufferGeometry,
   BufferGeometry,
   CanvasTexture,
   CanvasTexture,
-  DoubleSide,
   Line,
   Line,
   LineBasicMaterial,
   LineBasicMaterial,
   Mesh,
   Mesh,
@@ -105,7 +104,6 @@ const getTextTexture = () => {
 const geo = new PlaneGeometry(1, 1);
 const geo = new PlaneGeometry(1, 1);
 const material = new MeshBasicMaterial({
 const material = new MeshBasicMaterial({
   transparent: true,
   transparent: true,
-  side: DoubleSide,
 });
 });
 const text = new Mesh(geo, material);
 const text = new Mesh(geo, material);
 
 

+ 2 - 7
vite.config.ts

@@ -43,12 +43,6 @@ export default ({ mode }: any) => {
     envDir: envDir,
     envDir: envDir,
     build: {
     build: {
       outDir: `dist/${outDir}`,
       outDir: `dist/${outDir}`,
-      rollupOptions: {
-        // 防止打包时处理指定目录
-        external: [
-          /^\/static\/models\/.*/, // 正则匹配 /static/models/ 下的所有文件
-        ],
-      },
     },
     },
     base: "./",
     base: "./",
     resolve: {
     resolve: {
@@ -82,7 +76,8 @@ export default ({ mode }: any) => {
       {
       {
         name: "remove-static-models",
         name: "remove-static-models",
         closeBundle() {
         closeBundle() {
-          const dir = path.resolve(__dirname, "dist/static/models");
+          const dir = path.resolve(__dirname, 'dist', outDir || '', "static/models");
+          console.log('remove dist',  dir)
           if (fs.existsSync(dir)) {
           if (fs.existsSync(dir)) {
             fs.rmSync(dir, { recursive: true, force: true });
             fs.rmSync(dir, { recursive: true, force: true });
             console.log("Removed dist/static/models directory after build.");
             console.log("Removed dist/static/models directory after build.");

+ 4 - 1
需求

@@ -11,4 +11,7 @@
   1.选取两最大夹角的线段作为优先处理过度,使用两线段过度规则
   1.选取两最大夹角的线段作为优先处理过度,使用两线段过度规则
   2.排除选取过的线段,再选择两个夹角最大的线段做两线端规则(重复1,2,1,2) 直到没有线段,或者剩下一条线段
   2.排除选取过的线段,再选择两个夹角最大的线段做两线端规则(重复1,2,1,2) 直到没有线段,或者剩下一条线段
   3.所有过度的按优先级进行放置,优先选取的在上面,次级的在下面,进行裁剪。
   3.所有过度的按优先级进行放置,优先选取的在上面,次级的在下面,进行裁剪。
-  
+  
+
+江门测试数据:
+http://localhost:9010/#/overview?caseId=2&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjEsImRldmljZSI6ImRlZmF1bHQtZGV2aWNlIiwiZWZmIjotMSwicm5TdHIiOiJQQlFENG9PSTE5S2VTVzVpVEtodkNYOEJDeENSd0poUiIsImlkIjoxLCJ1c2VySWQiOjgxNywicnlJZCI6InN1cGVyLWFkbWluIiwiaXNBZG1pbiI6MSwicGxhdGZvcm1JZCI6MSwidXNlck5hbWUiOiJzdXBlci1hZG1pbiIsIm5pY2tOYW1lIjoi6LaF57qn566h55CG5ZGYIn0.1MMnvsVrKN9u32B-2PWe6oNJkFYLUE7g6M1ivg2lrdU&overviewId=189&tabulationId=250