feat(engine-manager): 暴露漫游功能方法
This commit is contained in:
@@ -8,6 +8,7 @@ import { RightKeyManager } from './right-key-manager';
|
||||
import { infoMenuButton } from '../components/menu/buttons/info';
|
||||
import { homeMenuButton } from '../components/menu/buttons/home';
|
||||
import type { MeasureMode } from '../types/measure';
|
||||
import type { SectionBoxRange } from '../components/section-box-panel/types';
|
||||
|
||||
/**
|
||||
* 3D 引擎管理器
|
||||
@@ -195,6 +196,49 @@ export class EngineManager extends BaseManager {
|
||||
return this.engineInstance.getCurrentSectionAxis();
|
||||
}
|
||||
|
||||
/** 激活剖切盒 */
|
||||
public activateSectionBox(): void {
|
||||
if (!this.engineInstance) {
|
||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||
return;
|
||||
}
|
||||
this.engineInstance.activateSectionBox();
|
||||
}
|
||||
|
||||
/** 停用剖切盒 */
|
||||
public deactivateSectionBox(): void {
|
||||
if (!this.engineInstance) {
|
||||
return;
|
||||
}
|
||||
this.engineInstance.deactivateSectionBox();
|
||||
}
|
||||
|
||||
/** 设置剖切盒范围(百分比 0-100) */
|
||||
public setSectionBoxRange(range: SectionBoxRange): void {
|
||||
if (!this.engineInstance) {
|
||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||
return;
|
||||
}
|
||||
this.engineInstance.setSectionBoxRange(range);
|
||||
}
|
||||
|
||||
/** 适应剖切盒到模型 */
|
||||
public fitSectionBoxToModel(): void {
|
||||
if (!this.engineInstance) {
|
||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||
return;
|
||||
}
|
||||
this.engineInstance.fitSectionBoxToModel();
|
||||
}
|
||||
|
||||
/** 重置剖切盒 */
|
||||
public resetSectionBox(): void {
|
||||
if (!this.engineInstance) {
|
||||
return;
|
||||
}
|
||||
this.engineInstance.resetSectionBox();
|
||||
}
|
||||
|
||||
/** 激活框选放大功能 */
|
||||
public activateZoomBox(): void {
|
||||
if (!this.engineInstance) {
|
||||
@@ -204,6 +248,74 @@ export class EngineManager extends BaseManager {
|
||||
this.engineInstance.activateZoomBox();
|
||||
}
|
||||
|
||||
// ==================== 漫游功能 ====================
|
||||
|
||||
/** 激活第一人称漫游模式 */
|
||||
public activateFirstPersonMode(): void {
|
||||
if (!this.engineInstance) {
|
||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||
return;
|
||||
}
|
||||
this.engineInstance.activateFirstPersonMode();
|
||||
}
|
||||
|
||||
/** 停用第一人称漫游模式 */
|
||||
public deactivateFirstPersonMode(): void {
|
||||
if (!this.engineInstance) {
|
||||
return;
|
||||
}
|
||||
this.engineInstance.deactivateFirstPersonMode();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置漫游移动速度
|
||||
* @param speed 移动速度
|
||||
*/
|
||||
public setWalkSpeed(speed: number): void {
|
||||
if (!this.engineInstance) {
|
||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||
return;
|
||||
}
|
||||
this.engineInstance.setWalkSpeed(speed);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置漫游重力开关
|
||||
* @param enabled 是否启用重力
|
||||
*/
|
||||
public setWalkGravity(enabled: boolean): void {
|
||||
if (!this.engineInstance) {
|
||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||
return;
|
||||
}
|
||||
this.engineInstance.setWalkGravity(enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置漫游碰撞检测开关
|
||||
* @param enabled 是否启用碰撞检测
|
||||
*/
|
||||
public setWalkCollision(enabled: boolean): void {
|
||||
if (!this.engineInstance) {
|
||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||
return;
|
||||
}
|
||||
this.engineInstance.setWalkCollision(enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取漫游模式是否激活
|
||||
* @returns 是否处于漫游模式
|
||||
*/
|
||||
public isFirstPersonModeActive(): boolean {
|
||||
if (!this.engineInstance) {
|
||||
return false;
|
||||
}
|
||||
return this.engineInstance.isFirstPersonModeActive();
|
||||
}
|
||||
|
||||
// ==================== 结束:漫游功能 ====================
|
||||
|
||||
/** 销毁引擎管理器 */
|
||||
public destroy(): void {
|
||||
if (this.engineInstance) {
|
||||
|
||||
Reference in New Issue
Block a user