@gcode-viewer/plugins 0.3.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.
Files changed (140) hide show
  1. package/README.md +26 -0
  2. package/dist/index.esm.js +288 -0
  3. package/dist/types/axis-gizmo/AxisGizmoPlugin.d.ts +25 -0
  4. package/dist/types/axis-gizmo/CoordinateAxes.d.ts +1 -0
  5. package/dist/types/axis-gizmo/index.d.ts +2 -0
  6. package/dist/types/bottom-bar/BottomBarPlugin.d.ts +36 -0
  7. package/dist/types/bottom-bar/index.d.ts +2 -0
  8. package/dist/types/context-menu/Constants.d.ts +34 -0
  9. package/dist/types/context-menu/ContextMenu.config.d.ts +2 -0
  10. package/dist/types/context-menu/ContextMenuPlugin.d.ts +23 -0
  11. package/dist/types/context-menu/Locale.d.ts +51 -0
  12. package/dist/types/context-menu/index.d.ts +4 -0
  13. package/dist/types/dat-gui/Viewer3dDatGui.d.ts +69 -0
  14. package/dist/types/dat-gui/index.d.ts +1 -0
  15. package/dist/types/explode/ExplodePlugin.d.ts +46 -0
  16. package/dist/types/explode/ObjectExploder.d.ts +48 -0
  17. package/dist/types/explode/index.d.ts +1 -0
  18. package/dist/types/export/ExportPlugin.d.ts +57 -0
  19. package/dist/types/export/Locale.d.ts +41 -0
  20. package/dist/types/export/gltf/GltfExporter.d.ts +32 -0
  21. package/dist/types/export/gltf/index.d.ts +1 -0
  22. package/dist/types/export/index.d.ts +2 -0
  23. package/dist/types/export/obj/ObjZipExporter.d.ts +14 -0
  24. package/dist/types/export/obj/index.d.ts +3 -0
  25. package/dist/types/export/obj/mtl.d.ts +9 -0
  26. package/dist/types/export/obj/textures.d.ts +15 -0
  27. package/dist/types/gcode-layer-bar/GCodeLayerBarPlugin.d.ts +66 -0
  28. package/dist/types/gcode-layer-bar/Locale.d.ts +13 -0
  29. package/dist/types/gcode-layer-bar/index.d.ts +2 -0
  30. package/dist/types/gcode-legend/GCodeLegendPlugin.d.ts +58 -0
  31. package/dist/types/gcode-legend/Locale.d.ts +83 -0
  32. package/dist/types/gcode-legend/NephogramLegend.d.ts +8 -0
  33. package/dist/types/gcode-legend/index.d.ts +2 -0
  34. package/dist/types/gcode-steps-bar/GCodeStepsBarPlugin.d.ts +46 -0
  35. package/dist/types/gcode-steps-bar/Locale.d.ts +11 -0
  36. package/dist/types/gcode-steps-bar/index.d.ts +2 -0
  37. package/dist/types/gcode-text-panel/GCodeTextPanelPlugin.d.ts +54 -0
  38. package/dist/types/gcode-text-panel/Locale.d.ts +11 -0
  39. package/dist/types/gcode-text-panel/index.d.ts +2 -0
  40. package/dist/types/ground-grid/GroundGridPlugin.d.ts +38 -0
  41. package/dist/types/ground-grid/index.d.ts +1 -0
  42. package/dist/types/ground-shaow/GroundShadowPlugin.d.ts +58 -0
  43. package/dist/types/ground-shaow/index.d.ts +1 -0
  44. package/dist/types/hotpoint/HotpointPlugin.d.ts +92 -0
  45. package/dist/types/hotpoint/index.d.ts +1 -0
  46. package/dist/types/index.d.ts +29 -0
  47. package/dist/types/local-model-uploader/IUploader.d.ts +55 -0
  48. package/dist/types/local-model-uploader/LocalModelUploader.d.ts +19 -0
  49. package/dist/types/local-model-uploader/index.d.ts +2 -0
  50. package/dist/types/measurements/AngleMeasureDrawable.d.ts +12 -0
  51. package/dist/types/measurements/AngleMeasurement.d.ts +13 -0
  52. package/dist/types/measurements/AreaMeasureDrawable.d.ts +14 -0
  53. package/dist/types/measurements/AreaMeasurement.d.ts +24 -0
  54. package/dist/types/measurements/BaseMeasureDrawable.d.ts +28 -0
  55. package/dist/types/measurements/BaseMeasurement.d.ts +123 -0
  56. package/dist/types/measurements/CoordinateMeasureDrawable.d.ts +10 -0
  57. package/dist/types/measurements/CoordinateMeasurement.d.ts +12 -0
  58. package/dist/types/measurements/DistanceMeasureDrawable.d.ts +13 -0
  59. package/dist/types/measurements/DistanceMeasurement.d.ts +21 -0
  60. package/dist/types/measurements/Locale.d.ts +13 -0
  61. package/dist/types/measurements/MeasurementPlugin.d.ts +102 -0
  62. package/dist/types/measurements/index.d.ts +3 -0
  63. package/dist/types/measurements/undo/AddMeasurementCommand.d.ts +10 -0
  64. package/dist/types/measurements/undo/RemoveMeasurementCommand.d.ts +10 -0
  65. package/dist/types/plate/PlatePlugin.d.ts +85 -0
  66. package/dist/types/plate/index.d.ts +1 -0
  67. package/dist/types/property/AnimationPanel.d.ts +3 -0
  68. package/dist/types/property/CameraEditor.d.ts +3 -0
  69. package/dist/types/property/EnvironmentPanel.d.ts +3 -0
  70. package/dist/types/property/LightEditor.d.ts +3 -0
  71. package/dist/types/property/Locale.d.ts +83 -0
  72. package/dist/types/property/MaterialEditor.d.ts +9 -0
  73. package/dist/types/property/PropertyPanelUi.d.ts +34 -0
  74. package/dist/types/property/PropertyPlugin.d.ts +95 -0
  75. package/dist/types/property/Utils.d.ts +19 -0
  76. package/dist/types/property/Vec3Field.d.ts +25 -0
  77. package/dist/types/property/index.d.ts +2 -0
  78. package/dist/types/rhino-3dm-loader/Rhino3dmLoaderPlugin.d.ts +17 -0
  79. package/dist/types/rhino-3dm-loader/Rhino3dmModelLoader.d.ts +25 -0
  80. package/dist/types/rhino-3dm-loader/index.d.ts +1 -0
  81. package/dist/types/scene-edit/SceneEditActions.d.ts +24 -0
  82. package/dist/types/scene-edit/SceneEditPlugin.d.ts +26 -0
  83. package/dist/types/scene-edit/SceneEditRecording.d.ts +11 -0
  84. package/dist/types/scene-edit/SceneMeshSnapshot.d.ts +23 -0
  85. package/dist/types/scene-edit/SceneMeshSnapshotUtils.d.ts +11 -0
  86. package/dist/types/scene-edit/SceneNodeSnapshot.d.ts +7 -0
  87. package/dist/types/scene-edit/SceneNodeSnapshotUtils.d.ts +11 -0
  88. package/dist/types/scene-edit/commands/GeometryEditCommand.d.ts +10 -0
  89. package/dist/types/scene-edit/commands/InsertSceneNodeCommand.d.ts +10 -0
  90. package/dist/types/scene-edit/commands/MaterialEditCommand.d.ts +10 -0
  91. package/dist/types/scene-edit/commands/MoveSceneNodeCommand.d.ts +10 -0
  92. package/dist/types/scene-edit/commands/RemoveSceneObjectCommand.d.ts +9 -0
  93. package/dist/types/scene-edit/commands/TransformSceneObjectCommand.d.ts +17 -0
  94. package/dist/types/scene-edit/index.d.ts +13 -0
  95. package/dist/types/screenshot/ScreenshotPlugin.d.ts +134 -0
  96. package/dist/types/screenshot/index.d.ts +1 -0
  97. package/dist/types/sections/AxisPlaneSection.d.ts +65 -0
  98. package/dist/types/sections/AxisSectionPopPanel.d.ts +18 -0
  99. package/dist/types/sections/BaseSection.d.ts +64 -0
  100. package/dist/types/sections/Locale.d.ts +21 -0
  101. package/dist/types/sections/ObjectsBoxSection.d.ts +29 -0
  102. package/dist/types/sections/PickPlaneSection.d.ts +48 -0
  103. package/dist/types/sections/PickSectionPopPanel.d.ts +18 -0
  104. package/dist/types/sections/Section.constants.d.ts +13 -0
  105. package/dist/types/sections/SectionGizmo.d.ts +22 -0
  106. package/dist/types/sections/SectionPlaneMesh.d.ts +23 -0
  107. package/dist/types/sections/SectionPlugin.d.ts +147 -0
  108. package/dist/types/sections/index.d.ts +6 -0
  109. package/dist/types/settings-3d/Locale.d.ts +61 -0
  110. package/dist/types/settings-3d/Settings3dPlugin.d.ts +46 -0
  111. package/dist/types/settings-3d/index.d.ts +2 -0
  112. package/dist/types/skybox/GradientColorSkybox.d.ts +9 -0
  113. package/dist/types/skybox/SkyboxPlugin.d.ts +48 -0
  114. package/dist/types/skybox/index.d.ts +1 -0
  115. package/dist/types/stats/StatsPlugin.d.ts +18 -0
  116. package/dist/types/stats/index.d.ts +2 -0
  117. package/dist/types/step-loader/OcctImportScriptLoader.d.ts +22 -0
  118. package/dist/types/step-loader/StepLoaderPlugin.d.ts +22 -0
  119. package/dist/types/step-loader/StepModelLoader.d.ts +39 -0
  120. package/dist/types/step-loader/index.d.ts +3 -0
  121. package/dist/types/step-loader/occtMeshBuilder.d.ts +35 -0
  122. package/dist/types/toolbars/Locale.d.ts +57 -0
  123. package/dist/types/toolbars/Toolbar.config.d.ts +5 -0
  124. package/dist/types/toolbars/Toolbar.constants.d.ts +71 -0
  125. package/dist/types/toolbars/Toolbar.d.ts +112 -0
  126. package/dist/types/toolbars/Viewer3dToolbarPlugin.d.ts +37 -0
  127. package/dist/types/toolbars/index.d.ts +5 -0
  128. package/dist/types/transform/Locale.d.ts +21 -0
  129. package/dist/types/transform/TransformPlugin.d.ts +38 -0
  130. package/dist/types/transform/index.d.ts +1 -0
  131. package/dist/types/tree-view/Locale.d.ts +29 -0
  132. package/dist/types/tree-view/TreeNodeTypeIcons.d.ts +15 -0
  133. package/dist/types/tree-view/TreeViewDragDrop.d.ts +17 -0
  134. package/dist/types/tree-view/TreeViewPlugin.d.ts +66 -0
  135. package/dist/types/tree-view/index.d.ts +2 -0
  136. package/dist/types/view-cube/Locale.d.ts +21 -0
  137. package/dist/types/view-cube/ViewCube.d.ts +86 -0
  138. package/dist/types/view-cube/ViewCubePlugin.d.ts +20 -0
  139. package/dist/types/view-cube/index.d.ts +2 -0
  140. package/package.json +73 -0
@@ -0,0 +1,64 @@
1
+ import { THREE } from "@gcode-viewer/core";
2
+ import { EventInfo, InputManager, type BaseViewer } from "@gcode-viewer/core";
3
+ /**
4
+ * Abstract base class for AxisPlaneSection, ObjectsBoxSection, etc.
5
+ */
6
+ export declare abstract class BaseSection {
7
+ protected viewer: BaseViewer;
8
+ protected inputManager: InputManager;
9
+ protected scene: THREE.Scene;
10
+ protected renderer: THREE.WebGLRenderer;
11
+ protected raycaster: THREE.Raycaster;
12
+ protected sectionBox: THREE.Box3;
13
+ protected lastWorldPos: THREE.Vector3;
14
+ protected mouseMoved: boolean;
15
+ protected dragStarted: boolean;
16
+ protected clipPlanes?: THREE.Plane[];
17
+ protected vertices?: THREE.Vector3[];
18
+ protected selectedObject?: THREE.Object3D;
19
+ protected refrencePlane: THREE.Plane;
20
+ protected active: boolean;
21
+ protected capsVisibility: boolean;
22
+ protected capsMaterial?: THREE.Material;
23
+ /**
24
+ * If to show section plane and gizmo or not.
25
+ */
26
+ showSectionPlane: boolean;
27
+ capsScene: THREE.Scene;
28
+ /**
29
+ * @hidden
30
+ */
31
+ clippingObjetIds?: number[];
32
+ constructor(viewer: BaseViewer, input: InputManager);
33
+ protected get canvas(): HTMLCanvasElement;
34
+ get isActive(): boolean;
35
+ protected get camera(): THREE.Camera;
36
+ private setGlobalClippingEnabled;
37
+ private setObjectClippingEnabled;
38
+ clearClippingObjectIds(): void;
39
+ setClippingEnabled(enable: boolean): void;
40
+ activate(): void;
41
+ deactivate(keepSectionState?: boolean): void;
42
+ setCapsVisible(visible: boolean): void;
43
+ getCapsVisible(): boolean;
44
+ setCapsMaterial(material: THREE.Material): void;
45
+ protected applyCapsMaterial(): void;
46
+ protected getCapsMaterial(): THREE.Material<THREE.MaterialEventMap> | undefined;
47
+ protected setControlsEnabled(enable: boolean): void;
48
+ protected mousedown: (e: EventInfo) => void;
49
+ protected mousemove: (e: EventInfo) => void;
50
+ protected mouseup: (e: EventInfo) => void;
51
+ protected keydown: (e: EventInfo) => void;
52
+ protected getIntersection(e: EventInfo): THREE.Intersection | undefined;
53
+ protected updateRaycasterByMouse(e: EventInfo): void;
54
+ destroy(): void;
55
+ protected abstract onDragStart(e: EventInfo): void;
56
+ protected abstract onDragMove(e: EventInfo): void;
57
+ protected abstract onDragEnd(e: EventInfo): void;
58
+ protected abstract getIntersectObjects(): THREE.Object3D[];
59
+ protected abstract activateSelectedObject(active: boolean): void;
60
+ protected abstract initOrUpdateSectionPlaneMeshes(): void;
61
+ protected abstract initOrUpdateClipPlanes(): void;
62
+ abstract reset(): void;
63
+ abstract setSectionPlaneVisible(visible: boolean): void;
64
+ }
@@ -0,0 +1,21 @@
1
+ import { i18n } from "@gcode-viewer/core";
2
+ export declare const en: {
3
+ pickPlaneSection: string;
4
+ pickSectionPlane: string;
5
+ axisSection: string;
6
+ hideSectionPlane: string;
7
+ showSectionPlane: string;
8
+ reset: string;
9
+ };
10
+ export declare const zh: {
11
+ pickPlaneSection: string;
12
+ pickSectionPlane: string;
13
+ axisSection: string;
14
+ hideSectionPlane: string;
15
+ showSectionPlane: string;
16
+ reset: string;
17
+ };
18
+ export declare const SECTION_I18N_NAMESPACE: "section";
19
+ export { i18n };
20
+ export type SectionTranslationKey = keyof typeof en;
21
+ export declare function t(key: SectionTranslationKey): string;
@@ -0,0 +1,29 @@
1
+ import { THREE, EventInfo, InputManager, ViewDirection, BaseViewer } from "@gcode-viewer/core";
2
+ import { BaseSection } from "./BaseSection";
3
+ import { SectionPlaneMesh } from "./SectionPlaneMesh";
4
+ export declare class ObjectsBoxSection extends BaseSection {
5
+ protected selectedObject?: SectionPlaneMesh;
6
+ protected planeMeshes?: SectionPlaneMesh[];
7
+ protected sectionRange: Record<string, number[]>;
8
+ private capsWireframes?;
9
+ constructor(viewer: BaseViewer, input: InputManager);
10
+ activate(): void;
11
+ deactivate(keepSectionState?: boolean): void;
12
+ protected initOrUpdateVertices(): void;
13
+ protected initOrUpdateClipPlanes(): void;
14
+ protected initOrUpdateSectionPlaneMeshes(): void;
15
+ protected initOrUpdateCapsWireframes(): void;
16
+ protected createCapsWireframe(actionType: ViewDirection, vertices: THREE.Vector3[], clipPlane: THREE.Plane): SectionPlaneMesh;
17
+ protected applyCapsMaterial(): void;
18
+ activateSelectedObject(active: boolean): void;
19
+ onDragStart(e: EventInfo): void;
20
+ onDragMove(e: EventInfo): void;
21
+ onDragEnd(e: EventInfo): void;
22
+ protected dragTranslateSectionPlane(axis: THREE.Vector3, from: THREE.Vector3, to: THREE.Vector3, actionType: ViewDirection): void;
23
+ protected isInRange(value: number, range: number[]): boolean;
24
+ protected getIntersection(e: EventInfo): THREE.Intersection | undefined;
25
+ getIntersectObjects(): SectionPlaneMesh[];
26
+ reset(): void;
27
+ setSectionPlaneVisible(visible: boolean): void;
28
+ setCapsVisible(visible: boolean): void;
29
+ }
@@ -0,0 +1,48 @@
1
+ import { THREE, EventInfo, InputManager } from "@gcode-viewer/core";
2
+ import type { BaseViewer } from "@gcode-viewer/core";
3
+ import { Tooltip } from "@gcode-viewer/ui";
4
+ import { BaseSection } from "../sections/BaseSection";
5
+ import { SectionGizmo } from "../sections/SectionGizmo";
6
+ import { SectionPlaneMesh } from "../sections/SectionPlaneMesh";
7
+ export declare class PickPlaneSection extends BaseSection {
8
+ protected pickedFaceInfo?: {
9
+ position: THREE.Vector3;
10
+ normal: THREE.Vector3;
11
+ };
12
+ protected gizmo?: SectionGizmo;
13
+ protected planeMesh?: SectionPlaneMesh;
14
+ protected capsWireframe?: SectionPlaneMesh;
15
+ protected clipPlane?: THREE.Plane;
16
+ protected selectedObject?: SectionPlaneMesh | THREE.Mesh | THREE.Object3D;
17
+ protected center: THREE.Vector3;
18
+ protected tooltip?: Tooltip;
19
+ protected lastMouseMoveIntersection?: THREE.Intersection;
20
+ private readonly rotationQuat;
21
+ constructor(viewer: BaseViewer, input: InputManager);
22
+ activate(): void;
23
+ deactivate(keepSectionState?: boolean): void;
24
+ setSection(): void;
25
+ reset(): void;
26
+ setSectionPlaneVisible(visible: boolean): void;
27
+ protected initOrUpdateClipPlanes(): void;
28
+ protected initOrUpdateSectionPlaneMeshes(): void;
29
+ private createCapsWireframe;
30
+ protected applyCapsMaterial(): void;
31
+ protected initOrUpdateGizmo(): void;
32
+ mousedown: (e: EventInfo) => void;
33
+ mousemove: (e: EventInfo) => void;
34
+ onDragStart(e: EventInfo): void;
35
+ onDragMove(e: EventInfo): void;
36
+ /**
37
+ * Rotate gizmo/section plane/caps with the same world-axis quaternion.
38
+ */
39
+ private rotateSectionByAxis;
40
+ onDragEnd(e: EventInfo): void;
41
+ getIntersectObjects(): THREE.Object3D[];
42
+ activateSelectedObject(active: boolean): void;
43
+ /**
44
+ * Picks an object by mouse position.
45
+ */
46
+ pickObject(e: EventInfo): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | undefined;
47
+ setCapsVisible(visible: boolean): void;
48
+ }
@@ -0,0 +1,18 @@
1
+ import { type BaseViewer } from "@gcode-viewer/core";
2
+ import { PopPanel } from "@gcode-viewer/ui";
3
+ import { PickPlaneSection } from "./PickPlaneSection";
4
+ export declare class PickSectionPopPanel extends PopPanel {
5
+ protected activeSelectNode?: Element;
6
+ protected isVisible: boolean;
7
+ protected enabled: boolean;
8
+ protected visibleNode?: HTMLElement;
9
+ protected resetNode?: HTMLElement;
10
+ protected section: PickPlaneSection;
11
+ constructor(viewer: BaseViewer);
12
+ keydown: (e: KeyboardEvent) => void;
13
+ destroy(): void;
14
+ createActiveSelectLayout(): void;
15
+ addActiveItems(): void;
16
+ enable(): void;
17
+ disable(): void;
18
+ }
@@ -0,0 +1,13 @@
1
+ import { THREE } from "@gcode-viewer/core";
2
+ export declare const AxisX: THREE.Vector3;
3
+ export declare const AxisY: THREE.Vector3;
4
+ export declare const AxisZ: THREE.Vector3;
5
+ export declare enum ActionType {
6
+ None = "",
7
+ TranslateX = "TranslateX",
8
+ TranslateY = "TranslateY",
9
+ TranslateZ = "TranslateZ",
10
+ RotateX = "RotateX",
11
+ RotateY = "RotateY",
12
+ RotateZ = "RotateZ"
13
+ }
@@ -0,0 +1,22 @@
1
+ import { THREE } from "@gcode-viewer/core";
2
+ import { ActionType } from "../sections/Section.constants";
3
+ export declare class SectionGizmo extends THREE.Group {
4
+ protected redMaterial: THREE.MeshBasicMaterial;
5
+ protected greenMaterial: THREE.MeshBasicMaterial;
6
+ protected blueMaterial: THREE.MeshBasicMaterial;
7
+ protected highlightMaterial: THREE.MeshBasicMaterial;
8
+ protected pickableMaterial: THREE.MeshBasicMaterial;
9
+ protected originalMaterial?: THREE.MeshBasicMaterial;
10
+ protected hoverObject?: THREE.Mesh;
11
+ constructor(normal?: THREE.Vector3);
12
+ initIgnoreClipMaterial(): void;
13
+ setDirection(normal: THREE.Vector3): void;
14
+ initOrUpdateByAxis(normal: THREE.Vector3): void;
15
+ createTranslateGizmo(actionType: ActionType, direction: THREE.Vector3, size: number, material: THREE.Material): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material<THREE.MaterialEventMap>, THREE.Object3DEventMap>;
16
+ createRotateGizmo(actionType: ActionType, direction: THREE.Vector3, size: number, material: THREE.Material, degree: number): THREE.Mesh<THREE.TorusGeometry, THREE.Material<THREE.MaterialEventMap>, THREE.Object3DEventMap>;
17
+ createSphere(size: number, material: THREE.Material, position?: THREE.Vector3): void;
18
+ setActiveAxis(axis: THREE.Vector3): void;
19
+ private createHoverRotateObjectByAxis;
20
+ setActive(active: boolean, selectObject: THREE.Mesh): void;
21
+ adjustSize(camera: THREE.Camera): void;
22
+ }
@@ -0,0 +1,23 @@
1
+ import { THREE } from "@gcode-viewer/core";
2
+ /**
3
+ * Visible section plan mesh.
4
+ */
5
+ export declare class SectionPlaneMesh extends THREE.Mesh {
6
+ static readonly normalPlaneColor: THREE.Color;
7
+ static readonly activePlaneColor: THREE.Color;
8
+ static readonly normalLineColor = 16777215;
9
+ actionType: string;
10
+ vertices: THREE.Vector3[];
11
+ edge: THREE.Line;
12
+ wireframe?: THREE.LineSegments;
13
+ constructor(actionType: string, vertices: THREE.Vector3[]);
14
+ createIgnoreClipMaterials(material: THREE.Material): void;
15
+ createEdge(vertices: THREE.Vector3[]): THREE.Line<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.LineBasicMaterial, THREE.Object3DEventMap>;
16
+ createLine(): void;
17
+ update(vertices: THREE.Vector3[]): void;
18
+ rotatePlane(axis: THREE.Vector3, angle: number): void;
19
+ setDirection(normal: THREE.Vector3): void;
20
+ getPlaneNormal(): THREE.Vector3;
21
+ setActive(active: boolean): void;
22
+ getPlaneCenter(): THREE.Vector3;
23
+ }
@@ -0,0 +1,147 @@
1
+ import { PluginConfig, THREE } from "@gcode-viewer/core";
2
+ import { type BaseViewer, Plugin } from "@gcode-viewer/core";
3
+ import { BaseSection } from "../sections/BaseSection";
4
+ /**
5
+ * Section type
6
+ */
7
+ export declare enum SectionType {
8
+ ObjectsBoxSection = "ObjectsBoxSection",
9
+ PickPlaneSection = "PickPlaneSection",
10
+ AxisPlaneSection = "AxisPlaneSection"
11
+ }
12
+ /**
13
+ * Section plugin config.
14
+ */
15
+ export interface SectionPluginConfig extends Partial<PluginConfig> {
16
+ capsVisible?: boolean;
17
+ capsColor?: THREE.ColorRepresentation;
18
+ /**
19
+ * Automatically skip non-closed (non-manifold) meshes during the cap
20
+ * stencil pass. Open meshes such as terrain surfaces, glass panes and
21
+ * sky domes leave unbalanced back/front fragment counts and otherwise
22
+ * fill regions that are not really part of the model's cross-section.
23
+ *
24
+ * Detection is done per `BufferGeometry` via an edge-share check and the
25
+ * result is cached on `geometry.userData._sectionCapClosed`. Explicit
26
+ * overrides via `setSkipSectionCap(mesh, true|false)` always win.
27
+ *
28
+ * Defaults to `true`.
29
+ */
30
+ autoSkipNonClosedMeshes?: boolean;
31
+ }
32
+ export declare const DEFAULT_CAPS_VISIBLE = true;
33
+ export declare const DEFAULT_CAPS_COLOR = 10265519;
34
+ export declare const DEFAULT_AUTO_SKIP_NON_CLOSED = true;
35
+ /**
36
+ * Section plugin, can be used by Viewer3d.
37
+ */
38
+ export declare class SectionPlugin extends Plugin {
39
+ static readonly DEFAULT_ID = "SectionPlugin";
40
+ constructor(viewer: BaseViewer, cfg?: SectionPluginConfig);
41
+ protected get raycaster(): THREE.Raycaster;
42
+ /**
43
+ * Activates one of "ObjectsBoxSection", "AxisPlaneSection" or "PickPlaneSection" Section
44
+ * @param {SectionType} type
45
+ * @param clippingObjectIds
46
+ */
47
+ activate(type: SectionType): void;
48
+ /**
49
+ * @description Deactivate Section plugin
50
+ * @param keepSectionState Keep objects being clipped even after deactived.
51
+ */
52
+ deactivate(keepSectionState?: boolean): void;
53
+ /**
54
+ * Resets section to initial state.
55
+ */
56
+ reset(): void;
57
+ /**
58
+ * Sets gizmo and section plane mesh visibility.
59
+ */
60
+ setSectionPlaneVisible(visible: boolean): void;
61
+ /**
62
+ * Sets section cut opening fill visibility.
63
+ */
64
+ setCapsVisible(visible: boolean): void;
65
+ /**
66
+ * Gets section cut opening fill visibility.
67
+ */
68
+ getCapsVisible(): boolean;
69
+ /**
70
+ * Sets section cut opening fill color.
71
+ */
72
+ setCapsColor(color: THREE.ColorRepresentation): void;
73
+ /**
74
+ * Excludes (or force-includes) a subtree from the section cap stencil
75
+ * pass.
76
+ *
77
+ * Stencil capping relies on each contributing mesh being a closed solid
78
+ * so that back-/front-face fragment counts cancel outside the cut.
79
+ * Non-closed meshes (terrain surfaces, glass panes, sky domes, single-
80
+ * sided floor tiles, ...) otherwise leave a permanent imbalance and
81
+ * fill regions of the cap that are not really part of the model's
82
+ * cross-section.
83
+ *
84
+ * By default the plugin auto-detects this via an edge-share manifold
85
+ * test (`autoSkipNonClosedMeshes`). Use this method to override the
86
+ * decision for a subtree:
87
+ * - `skip = true` → always exclude from the stencil pass.
88
+ * - `skip = false` → always include, even if auto-detection would
89
+ * have marked it as non-closed.
90
+ * - `skip = "auto"` → clear the override and fall back to auto-detect.
91
+ */
92
+ setSkipSectionCap(object: THREE.Object3D, skip?: boolean | "auto"): void;
93
+ /**
94
+ * Enables/disables automatic detection of non-closed meshes for the
95
+ * section cap stencil pass. See `autoSkipNonClosedMeshes` in
96
+ * `SectionPluginConfig` for details.
97
+ */
98
+ setAutoSkipNonClosedMeshes(enabled: boolean): void;
99
+ /**
100
+ * Returns the nearest ancestor whose mesh children should be treated as
101
+ * one logical cap object. By default this is `mesh.parent` (e.g. an
102
+ * IFC element like `Wall_-_Timber_Clad_<418079>` that contains many
103
+ * small face quads). The model group root is never returned so that
104
+ * meshes that sit directly under the root are still tested
105
+ * individually.
106
+ */
107
+ static findCapGroup(mesh: THREE.Object3D, modelRoot?: THREE.Object3D): THREE.Object3D | undefined;
108
+ /**
109
+ * Checks whether the union of all `THREE.Mesh` descendants of `group`
110
+ * forms a closed (edge-manifold) surface. Vertex positions are binned
111
+ * with a tolerance so that meshes that share a seam by coordinate (the
112
+ * usual case for IFC→glTF face quads) are correctly stitched.
113
+ * Result is cached on `group.userData._sectionCapClosed`.
114
+ */
115
+ static isGroupClosedManifold(group: THREE.Object3D): boolean;
116
+ /**
117
+ *
118
+ * @returns {boolean} Is Section active
119
+ */
120
+ isActive(): boolean;
121
+ /**
122
+ * Gets the active section type.
123
+ */
124
+ getActiveSectionType(): SectionType | undefined;
125
+ /**
126
+ * Gets the active section.
127
+ */
128
+ getActiveSection(): BaseSection | undefined;
129
+ /**
130
+ * Sets clipping object ids for all sections.
131
+ * @param ids
132
+ * @returns
133
+ * @description Set the id of the object that needs to be clipping for all section
134
+ */
135
+ setClippingObjectIds(ids?: number[]): void;
136
+ /**
137
+ * Sets clipping object ids for a specific SectionType.
138
+ * @param ids
139
+ * @returns
140
+ * @description Set the id of the object that needs to be clipping for section by section type
141
+ */
142
+ setClippingObjectIdsForType(type: SectionType, ids?: number[]): void;
143
+ /**
144
+ * Destroies this plugin.
145
+ */
146
+ destroy(): void;
147
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./BaseSection";
2
+ export * from "./AxisPlaneSection";
3
+ export * from "./ObjectsBoxSection";
4
+ export * from "./PickPlaneSection";
5
+ export * from "./SectionPlugin";
6
+ export * from "./Section.constants";
@@ -0,0 +1,61 @@
1
+ import { i18n } from "@gcode-viewer/core";
2
+ export declare const en: {
3
+ settings: string;
4
+ showOutline: string;
5
+ doubleSidedMaterials: string;
6
+ showGroundGrid: string;
7
+ groundGridHeight: string;
8
+ showViewCube: string;
9
+ showAxesHelper: string;
10
+ enableGroundShadow: string;
11
+ enableQuantization: string;
12
+ regenGroundShadowTitle: string;
13
+ skybox: string;
14
+ colorWhite: string;
15
+ colorBlack: string;
16
+ colorGray: string;
17
+ gradientColor1: string;
18
+ gradientColor2: string;
19
+ gradientColor3: string;
20
+ setEnvMap: string;
21
+ default: string;
22
+ cityStreet: string;
23
+ grass: string;
24
+ sunshine: string;
25
+ showPerformanceStats: string;
26
+ language: string;
27
+ languageEn: string;
28
+ languageZh: string;
29
+ };
30
+ export declare const zh: {
31
+ settings: string;
32
+ showOutline: string;
33
+ doubleSidedMaterials: string;
34
+ showGroundGrid: string;
35
+ groundGridHeight: string;
36
+ showViewCube: string;
37
+ showAxesHelper: string;
38
+ enableGroundShadow: string;
39
+ enableQuantization: string;
40
+ regenGroundShadowTitle: string;
41
+ skybox: string;
42
+ colorWhite: string;
43
+ colorBlack: string;
44
+ colorGray: string;
45
+ gradientColor1: string;
46
+ gradientColor2: string;
47
+ gradientColor3: string;
48
+ setEnvMap: string;
49
+ default: string;
50
+ cityStreet: string;
51
+ grass: string;
52
+ sunshine: string;
53
+ showPerformanceStats: string;
54
+ language: string;
55
+ languageEn: string;
56
+ languageZh: string;
57
+ };
58
+ export declare const SETTINGS_3D_I18N_NAMESPACE: "settings3d";
59
+ export { i18n };
60
+ export type Settings3dTranslationKey = keyof typeof en;
61
+ export declare function t(key: Settings3dTranslationKey): string;
@@ -0,0 +1,46 @@
1
+ import { Viewer3d, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ import { BasePanel } from "@gcode-viewer/ui";
3
+ /**
4
+ * Setting 3d plugin.
5
+ */
6
+ export interface Settings3dPluginConfig extends Partial<PluginConfig> {
7
+ /**
8
+ * Container div id.
9
+ */
10
+ containerId?: string;
11
+ /**
12
+ * If panel is visible. It is visible by default.
13
+ */
14
+ visible?: boolean;
15
+ }
16
+ /**
17
+ * Setting 3d plugin events.
18
+ */
19
+ type Settings3dPluginEvents = {
20
+ /**
21
+ * Panel visibility change event.
22
+ */
23
+ visibilitychange: boolean;
24
+ };
25
+ /**
26
+ * Setting 3d.
27
+ * Can be used by Viewer3d.
28
+ */
29
+ export declare class Settings3dPlugin extends Plugin<Settings3dPluginEvents> {
30
+ static readonly DEFAULT_ID = "Settings3dPlugin";
31
+ protected cfg: Settings3dPluginConfig;
32
+ protected basePanel?: BasePanel;
33
+ protected container?: HTMLDivElement;
34
+ protected content?: HTMLDivElement;
35
+ constructor(viewer: Viewer3d, cfg?: Settings3dPluginConfig);
36
+ protected init(): void;
37
+ private onLanguageChange;
38
+ protected applyLocalizedChrome(): void;
39
+ private applyLanguageSelectChrome;
40
+ setVisible(visible: boolean): void;
41
+ isVisible(): boolean;
42
+ destroy(): void;
43
+ addContent(): void;
44
+ protected addEventHandlers(): void;
45
+ }
46
+ export {};
@@ -0,0 +1,2 @@
1
+ import "./Settings3d.scss";
2
+ export * from "./Settings3dPlugin";
@@ -0,0 +1,9 @@
1
+ import { THREE } from "@gcode-viewer/core";
2
+ export declare class GradientColorSkybox extends THREE.Mesh {
3
+ static readonly NAME = "SKYBOX";
4
+ static readonly MIN_SKY_RADIUS = 50000;
5
+ static readonly MAX_SKY_RADIUS = 200000;
6
+ private vertexShader;
7
+ private fragmentShader;
8
+ constructor(topColor: THREE.Color, skylineColor: THREE.Color, bottomColor: THREE.Color, radius?: number, widthSegments?: number, heightSegments?: number, skyCenter?: THREE.Vector3, sunDirection?: THREE.Vector3);
9
+ }
@@ -0,0 +1,48 @@
1
+ import { THREE, BaseViewer, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ import { GradientColorSkybox } from "./GradientColorSkybox";
3
+ /**
4
+ * Skybox plugin config.
5
+ */
6
+ export interface SkyboxPluginConfig extends Partial<PluginConfig> {
7
+ /**
8
+ * Initial single color of the skybox.
9
+ * If specified, it initialize with a single color background. Otherwise,
10
+ * the skybox initialize with default gradient colors.
11
+ */
12
+ color?: number[];
13
+ }
14
+ /**
15
+ * Skybox plugin. It is mainly used by Viewer3d, while can also be used by Viewer2d.
16
+ * You can set skybox in several means:
17
+ * 1) Single color, by using setSkyboxByColor().
18
+ * 2) Gradient colors, by using setSkyboxByGradientColors().
19
+ * 3) Cube texture, by using setSkyboxByCubeTexture().
20
+ */
21
+ export declare class SkyboxPlugin extends Plugin {
22
+ static readonly DEFAULT_ID = "SkyboxPlugin";
23
+ protected gradientColorSkybox?: GradientColorSkybox;
24
+ protected enabled: boolean;
25
+ constructor(viewer: BaseViewer, cfg?: SkyboxPluginConfig);
26
+ setEnabled(enable: boolean): void;
27
+ isEnabled(): boolean;
28
+ /**
29
+ * Set skybox by a single color.
30
+ * @param color rgb number array, each value is between 0 and 1. e.g. [0.92, 0.95, 0.96]
31
+ */
32
+ setSkyboxByColor(color?: number[]): void;
33
+ /**
34
+ * Sets skybox by 3 gradient colors (top, skyline, bottom).
35
+ */
36
+ setSkyboxByGradientColors(topColor?: number[], // 0x86b6f5
37
+ skylineColor?: number[], // 0xffffff
38
+ bottomColor?: number[]): void;
39
+ /**
40
+ * Sets skybox by cube texture (6 images).
41
+ */
42
+ setSkyboxByCubeTexture(urls: string[]): void;
43
+ destroy(): void;
44
+ /**
45
+ * Converts rgb color number array to THREE.Color.
46
+ */
47
+ protected rgb2Color(color: number[]): THREE.Color;
48
+ }
@@ -0,0 +1 @@
1
+ export * from "./SkyboxPlugin";
@@ -0,0 +1,18 @@
1
+ import { BaseViewer, Plugin } from "@gcode-viewer/core";
2
+ import Stats from "stats.js";
3
+ /**
4
+ * Stats plugin is a debug tool for developers to observe the performance of a page.
5
+ */
6
+ export declare class StatsPlugin extends Plugin {
7
+ static readonly DEFAULT_ID = "StatsPlugin";
8
+ protected stats?: Stats;
9
+ /** Mirrors {@link setVisible}: stats.js uses `showPanel(-1)` to hide all panels. */
10
+ private statsUiVisible;
11
+ constructor(viewer: BaseViewer);
12
+ /**
13
+ * Shows or hide the stats panel, which indicates current FPS, MS, MB, etc.
14
+ */
15
+ setVisible(visible: boolean): void;
16
+ isVisible(): boolean;
17
+ destroy(): void;
18
+ }
@@ -0,0 +1,2 @@
1
+ import "./stats.scss";
2
+ export * from "./StatsPlugin";
@@ -0,0 +1,22 @@
1
+ export type OcctImportModuleConfig = {
2
+ locateFile?: (path: string, prefix: string) => string;
3
+ };
4
+ export type OcctImportResult = {
5
+ success: boolean;
6
+ reason?: string;
7
+ };
8
+ export type OcctImportRuntime = {
9
+ ReadStepFile: (content: Uint8Array, params: unknown) => OcctImportResult;
10
+ ReadIgesFile: (content: Uint8Array, params: unknown) => OcctImportResult;
11
+ ReadBrepFile: (content: Uint8Array, params: unknown) => OcctImportResult;
12
+ };
13
+ export type OcctImportFactory = (config?: OcctImportModuleConfig) => Promise<OcctImportRuntime>;
14
+ /**
15
+ * Loads occt-import-js IIFE bundle once per script URL and returns the runtime factory.
16
+ */
17
+ export declare function loadOcctImportOnce(scriptUrl: string): Promise<OcctImportFactory>;
18
+ export declare function buildOcctModuleConfig(wasmBaseUrl: string): OcctImportModuleConfig;
19
+ /**
20
+ * Single cached occt-import-js wasm runtime per (scriptUrl, wasmBaseUrl). Shared by STEP, IGES, and BREP loaders.
21
+ */
22
+ export declare function getOcctImportRuntime(scriptUrl: string, wasmBaseUrl: string): Promise<OcctImportRuntime>;
@@ -0,0 +1,22 @@
1
+ import { BaseViewer, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ export interface StepLoaderPluginConfig extends Partial<PluginConfig> {
3
+ /**
4
+ * Folder URL for `occt-import-js.wasm` (trailing `/` optional), passed to `locateFile`.
5
+ * Default: jsDelivr `occt-import-js` `dist/`.
6
+ */
7
+ wasmBaseUrl?: string;
8
+ /**
9
+ * Full URL to `occt-import-js.js`.
10
+ * Default: jsDelivr `occt-import-js`.
11
+ */
12
+ scriptUrl?: string;
13
+ }
14
+ /**
15
+ * Registers STEP (`.step` / `.stp`), IGES (`.iges` / `.igs`), and BREP (`.brep` / `.rle`) via one occt-import-js loader.
16
+ */
17
+ export declare class StepLoaderPlugin extends Plugin {
18
+ static readonly DEFAULT_ID = "StepLoaderPlugin";
19
+ private readonly loader;
20
+ constructor(viewer: BaseViewer, cfg?: StepLoaderPluginConfig);
21
+ destroy(): void;
22
+ }