4.2 KiB
4.2 KiB
| outline | ||
|---|---|---|
|
ClippingPlane
- 源文件:
packages/sdk/src/manager/ClippingPlane.ts - 文档位置:
packages/docs/api/manager/ClippingPlane.md
接口:IClippingPlaneOptions
- 作用:IClippingPlaneOptions 的结构定义。
字段
| 字段名 | 类型 | 必填 | 作用 |
|---|---|---|---|
normal |
THREE.Vector3 |
是 | 法线方向。 |
constant |
number |
否 | 平面常量。 |
color |
THREE.Color |
否 | 颜色配置。 |
enableTransformControls |
boolean |
否 | 是否启用变换控制器。 |
transformMode |
"translate" | "rotate" |
否 | 变换控制模式。 |
类:ClippingPlane
- 作用:ClippingPlane 类。
构造函数
new ClippingPlane(viewer: Viewer, options: IClippingPlaneOptions)
-
作用:创建剖切平面实例
-
入参:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
viewer |
Viewer |
是 | 视图实例 |
options |
IClippingPlaneOptions |
是 | 剖切面配置 |
- 出参:
ClippingPlane - 返回说明:返回当前类实例。
属性
| 属性名 | 可见性 | 类型 | 作用 |
|---|---|---|---|
plane |
public |
THREE.Plane |
当前剖切面对应的数学平面对象。 |
helper |
public |
ClippingHelper | undefined |
剖切面的可视化辅助对象。 |
transformControl |
public |
TransformControls | undefined |
用于拖拽平面位置和朝向的变换控制器。 |
emitter |
public |
Emittery<{ move: { position: THREE.Vector3; constant: number; normal: THREE.Vector3; }; }, { move: { position: THREE.Vector3; constant: number; normal: THREE.Vector3; }; } & OmnipresentEventData, never> |
剖切面移动事件发射器。 |
viewer |
public readonly |
Viewer |
关联的 Viewer 实例。 |
options |
public readonly |
IClippingPlaneOptions |
剖切面的初始化配置。 |
方法
updatePlaneFromHelper(): void
-
作用:根据 helper 当前姿态回写 plane
-
入参:无
-
出参:
void -
返回说明:无返回值。
createHelper(worldPosition: THREE.Vector3, size: number, group: THREE.Group): void
-
作用:创建 ClippingHelper,定位到指定世界坐标,并加入 group
-
入参:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
worldPosition |
THREE.Vector3 |
是 | 平面中心世界坐标 |
size |
number |
是 | helper 的宽高 |
group |
THREE.Group |
是 | 要加入的父级 Group |
- 出参:
void - 返回说明:无返回值。
detach(): void
-
作用:解绑辅助对象
-
入参:无
-
出参:
void -
返回说明:无返回值。
setTransformMode(mode: "translate" | "rotate"): void
-
作用:设置变换模式
-
入参:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
mode |
"translate" | "rotate" |
是 | 变换模式 |
- 出参:
void - 返回说明:无返回值。
setTransformSpace(space: "world" | "local"): void
-
作用:设置变换空间并同步刷新轴约束
-
入参:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
space |
"world" | "local" |
是 | 变换空间 |
- 出参:
void - 返回说明:无返回值。
createDebugPanel(label = "Clipping Plane"): void
-
作用:创建调试面板,支持移动/旋转切换及 XYZ 数值控制
-
入参:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
label |
string |
否 | 面板标题 |
- 出参:
void - 返回说明:无返回值。
showRotateHandles(show: boolean): void
-
作用:显示或隐藏旋转控制手柄图标。 首次调用 true 时会懒加载图标贴图;设为 false 时隐藏图标。
-
入参:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
show |
boolean |
是 | 是否显示旋转手柄 |
- 出参:
void - 返回说明:无返回值。
dispose(): void
-
作用:释放资源
-
入参:无
-
出参:
void -
返回说明:无返回值。
构造示例
- 当前 Demo 中没有直接展示
ClippingPlane的构造调用。
函数示例
- 当前 Demo 中没有直接展示
ClippingPlane的公开方法调用。