iflow-engine-base 3.4.12 → 3.4.13

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.d.ts CHANGED
@@ -509,10 +509,14 @@ declare class Clipping {
509
509
  sectionBox: any;
510
510
  sectionFace: any;
511
511
  clippingStencil: any;
512
+ clippingCSGSimple: ClippingCSGOptimizedSimple | null;
512
513
  currentClippingMode: string;
514
+ fillCutFace: boolean;
513
515
  constructor(engine: any);
514
516
  init(): void;
515
517
  scaleBox(): void;
518
+ setFillCutFace(b: boolean): void;
519
+ getFillCutFace(): boolean;
516
520
  clippingModel(models: any): void;
517
521
  updateClippingValue(value: any): void;
518
522
  active(type: string): void;
@@ -543,6 +547,137 @@ declare class Clipping {
543
547
  }): void;
544
548
  }
545
549
 
550
+ /**
551
+ * ClippingCSGOptimizedSimple
552
+ *
553
+ * 作用:
554
+ * 1. 根据剖切平面,计算模型与“薄片平面体”的 CSG 相交结果。
555
+ * 2. 从相交结果中提取贴近平面的帽面三角形(cap)。
556
+ * 3. 合并 cap 几何并加入场景,作为剖切补面。
557
+ *
558
+ * 设计要点:
559
+ * - 先粗筛(octree box / mesh box),再做重计算(CSG),避免全量布尔运算。
560
+ * - 对补面做极小偏移,避免补面材质本身也挂 clippingPlanes 时被同平面裁掉。
561
+ * - 每次更新前先 clear,保证场景中只存在当前补面。
562
+ */
563
+ declare class ClippingCSGOptimizedSimple {
564
+ /** 引擎实例(包含 scene / models / engineStatus / octreeBox 等) */
565
+ private engine;
566
+ /** three-bvh-csg 计算器,负责执行布尔操作 */
567
+ private readonly evaluator;
568
+ /** 场景中补面 Mesh 的统一名前缀 */
569
+ private readonly fillMeshName;
570
+ /**
571
+ * 当前生成的补面集合。
572
+ * key:平面唯一键(face 或 plane-i-name)
573
+ * value:对应补面 Mesh
574
+ */
575
+ private readonly fillMeshes;
576
+ /** 单次最多参与 CSG 的候选 Mesh 数量(保护性能) */
577
+ private readonly maxCandidates;
578
+ /** 单个 mesh 最大三角面阈值(过大直接跳过,保护实时交互) */
579
+ private readonly maxTriangleCountPerMesh;
580
+ /** 补面统一材质(由你在构造器中挂了 clippingPlanes) */
581
+ private fillMaterial;
582
+ constructor(engine: any);
583
+ /**
584
+ * 清理当前所有补面。
585
+ * - 从 scene 移除 mesh
586
+ * - 释放 geometry / material 资源
587
+ */
588
+ clear(): void;
589
+ /**
590
+ * 单平面补面入口(face/x/y/z 模式可用)。
591
+ * 每次调用先 clear,再构建当前平面的补面。
592
+ */
593
+ updataFace(plane: any): void;
594
+ /**
595
+ * 多平面补面入口(box 模式可用)。
596
+ * 约定:传入的每个合法平面都分别生成一份补面。
597
+ */
598
+ updataFaces(planes: any[]): void;
599
+ /**
600
+ * 构建某一个平面的补面。
601
+ *
602
+ * 主流程:
603
+ * 1) 拿场景包围盒,确定平面体尺寸。
604
+ * 2) 基于 octree 与 plane 相交,筛候选 mesh。
605
+ * 3) 再按 mesh world box 与复杂度做二次筛选。
606
+ * 4) 对每个候选 mesh 执行 CSG INTERSECTION。
607
+ * 5) 从交集几何中提取贴近平面的 cap 三角形。
608
+ * 6) 合并 cap,做轻微偏移,创建补面 mesh。
609
+ */
610
+ private buildSinglePlaneFill;
611
+ /**
612
+ * 获取补面偏移距离。
613
+ * - 可通过 engine.engineStatus.clippingFaceOffset 覆盖
614
+ * - 默认按模型尺度自适应并带最小值
615
+ */
616
+ private getFaceOffsetDistance;
617
+ /**
618
+ * 获取补面偏移方向。
619
+ * - 可通过 engine.engineStatus.clippingFaceOffsetSign 指定(1/-1)
620
+ * - 默认 -1,即沿 -normal 方向偏移
621
+ */
622
+ private getFaceOffsetSign;
623
+ /**
624
+ * 使用 octree + plane 相交快速收集候选 mesh。
625
+ *
626
+ * 过程:
627
+ * - 遍历 engineStatus.models -> lod.octreeBox
628
+ * - 只取与 plane 相交的 octree 节点元素 id
629
+ * - 跳过隐藏/半透明/实例化节点
630
+ * - 收集节点 infos 里的 mesh,并按 uuid 去重
631
+ */
632
+ private collectCandidateMeshesFromOctree;
633
+ /**
634
+ * 收集当前 model url 下需要忽略的元素 id(隐藏 + 半透明)。
635
+ */
636
+ private getIgnoredIds;
637
+ /**
638
+ * 深度遍历 octree,返回与 plane 相交节点中的 element id 集合。
639
+ */
640
+ private collectIntersectElementIds;
641
+ /**
642
+ * 将引擎 octree 节点坐标转换为 three.js 的 Box3(含单位/坐标系转换)。
643
+ */
644
+ private octreeNodeToBox3;
645
+ /**
646
+ * 候选 mesh 二次筛选:
647
+ * - 必须存在有效 position
648
+ * - 三角面数不能超过阈值
649
+ * - world bbox 必须与 plane 相交
650
+ */
651
+ private filterMeshesByBoxAndComplexity;
652
+ /**
653
+ * 构造“薄片平面体” Brush:
654
+ * - 几何为 BoxGeometry(size, size, thickness)
655
+ * - 旋转到 plane.normal
656
+ * - 平移到 plane 上
657
+ */
658
+ private createPlaneBrush;
659
+ /**
660
+ * 将场景 mesh 转为世界坐标 Brush。
661
+ */
662
+ private createWorldBrushFromMesh;
663
+ /**
664
+ * 统一 CSG 输入属性,避免属性不一致报错(例如 uv 缺失)。
665
+ * 目标属性固定为:position / normal / uv
666
+ */
667
+ private toCsgReadyGeometry;
668
+ /**
669
+ * 从 CSG 相交结果中提取补面三角形。
670
+ *
671
+ * 判定条件:
672
+ * - 三角形法线与 plane.normal 足够平行(|dot| >= 0.9)
673
+ * - 三角形顶点到平面的距离 spread 足够小
674
+ * - 三角形平均距离落在薄片附近,且位于有效侧
675
+ *
676
+ * 提取后将三角形顶点投影回 plane,保证补面共面。
677
+ */
678
+ private extractPlaneCapGeometry;
679
+ }
680
+
546
681
  declare class ComposerModule {
547
682
  private engine;
548
683
  composer: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iflow-engine-base",
3
- "version": "3.4.12",
3
+ "version": "3.4.13",
4
4
  "description": "BIM Engine SDK for Vue2, Vue3, React and HTML",
5
5
  "main": "./dist/bim-engine-sdk.umd.js",
6
6
  "module": "./dist/bim-engine-sdk.es.js",