@openheart/tavio-renderer 2.6.1 → 2.6.3
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/build/esm/index.js +1365 -1110
- package/build/esm/types/camera/orbitControls.d.ts +5 -0
- package/build/esm/types/editor/visibleAreaHelper.d.ts +36 -0
- package/build/esm/types/math/plane.d.ts +8 -0
- package/build/esm/types/module.d.ts +5 -3
- package/build/esm/types/viewer/canvas.d.ts +26 -3
- package/build/esm/types/viewer/driver/coreDriver.d.ts +69 -3
- package/build/esm/types/viewer/driver/iCoreDriver.d.ts +13 -3
- package/build/esm/types/viewer/driver/offscreenDriver.d.ts +15 -7
- package/build/esm/types/viewer/tavioMesh/tavioMesh.d.ts +13 -2
- package/build/esm/types/viewer/types.d.ts +20 -0
- package/build/esm/types/wasm-bindings/wasm-handlers.d.ts +1 -1
- package/build/esm/types/wasm-bindings/wasm-worker-client.d.ts +8 -0
- package/package.json +1 -1
|
@@ -119,6 +119,11 @@ export declare class OrbitControls extends EventEmitter {
|
|
|
119
119
|
* 設定されているカメラの情報を各プロパティに反映する
|
|
120
120
|
*/
|
|
121
121
|
syncCameraParameter(): void;
|
|
122
|
+
/**
|
|
123
|
+
* 操作の慣性(ズーム・回転・平行移動の残り、バウンス)を打ち消して、現在のカメラの状態で静止させる
|
|
124
|
+
* カメラを外部から動かす間に、直前の操作の慣性でカメラが引き戻されないようにするために使う
|
|
125
|
+
*/
|
|
126
|
+
stopMotion(): void;
|
|
122
127
|
/**
|
|
123
128
|
* 注視点とカメラの距離を返す
|
|
124
129
|
*/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Group } from 'three';
|
|
2
|
+
import { iVectorLike } from '../viewer/types';
|
|
3
|
+
export interface iVisibleAreaHelperOption {
|
|
4
|
+
/** "sphere": 楕円体 / "cube": 直方体 */
|
|
5
|
+
type: "sphere" | "cube";
|
|
6
|
+
/** 領域の中心(ワールド座標) */
|
|
7
|
+
position: iVectorLike | [number, number, number];
|
|
8
|
+
/** 各軸の大きさ(sphere は直径、cube は辺の長さ) */
|
|
9
|
+
size: iVectorLike | [number, number, number];
|
|
10
|
+
/** 回転(ラジアン、オイラー角 XYZ 順)。省略時は回転なし */
|
|
11
|
+
rotation?: iVectorLike | [number, number, number];
|
|
12
|
+
/** 線と面の色(デフォルト: 0x13acfc) */
|
|
13
|
+
color?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* クロップ領域(表示領域)を、輪郭の線と薄い半透明の面で表示するヘルパー。
|
|
17
|
+
* 単位サイズの形を position / rotation / size で変換して表示する。
|
|
18
|
+
* 点群に埋もれても見えるよう深度テストは行わない
|
|
19
|
+
*/
|
|
20
|
+
export declare class VisibleAreaHelper extends Group {
|
|
21
|
+
private areaType;
|
|
22
|
+
private fill;
|
|
23
|
+
private lines;
|
|
24
|
+
constructor(option: iVisibleAreaHelperOption, resolution: {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
});
|
|
28
|
+
/** 形・位置・大きさ・回転・色を更新する。形が変わった場合だけジオメトリを作り直す */
|
|
29
|
+
update(option: iVisibleAreaHelperOption): void;
|
|
30
|
+
/** 線の太さ(px)を計算するための描画領域のサイズを設定する */
|
|
31
|
+
setResolution(resolution: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
}): void;
|
|
35
|
+
dispose(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Vector3 } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* 点群に最もよく当てはまる平面の法線を主成分分析で求める
|
|
4
|
+
* 点が 3 つ未満、または直線状・一点に集中していて平面が定まらない場合は null を返す
|
|
5
|
+
* @param points - 平面を推定する点群
|
|
6
|
+
* @returns 正規化された法線(向きは不定)
|
|
7
|
+
*/
|
|
8
|
+
export declare function estimatePlaneNormal(points: Vector3[]): Vector3 | null;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Core } from './viewer/canvas';
|
|
2
|
-
import { TavioError, tSelectionMode, tMaskSource, iLoadingOption, iViewerOption, iHeaderInfo, iDistanceInfo, iTransform, iVectorLike, tUniformPlainValue, tCustomDefines, tCustomUniformValue, tCustomUniforms } from './viewer/types';
|
|
2
|
+
import { TavioError, tSelectionMode, tMaskSource, iLoadingOption, iViewerOption, iHeaderInfo, iDistanceInfo, iTransform, iVectorLike, iSurfaceInfo, iFocusMarkerOption, tUniformPlainValue, tCustomDefines, tCustomUniformValue, tCustomUniforms } from './viewer/types';
|
|
3
3
|
import { TAVIO_ERROR_CODE, SELECTION_MODE } from './viewer/constants';
|
|
4
4
|
import { CHUNK_TARGET, SHADER_STAGE, iMaterialOption } from './viewer/materialGenerator';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { iVisibleAreaHelperOption } from './editor/visibleAreaHelper';
|
|
6
|
+
import { setWasmBaseUrl } from './wasm-bindings/wasm-worker-client';
|
|
7
|
+
export { Core, TavioError, TAVIO_ERROR_CODE, SELECTION_MODE, CHUNK_TARGET, SHADER_STAGE, setWasmBaseUrl, };
|
|
8
|
+
export type { iMaterialOption, iVisibleAreaHelperOption, tSelectionMode, tMaskSource, iLoadingOption, iViewerOption, iHeaderInfo, iDistanceInfo, iTransform, iVectorLike, iSurfaceInfo, iFocusMarkerOption, tUniformPlainValue, tCustomDefines, tCustomUniformValue, tCustomUniforms, };
|
|
7
9
|
export default Core;
|
|
@@ -3,11 +3,12 @@ import { MeshStandardMaterialParameters } from 'three';
|
|
|
3
3
|
import { iLatitudeLongitude } from '../camera/flightControls';
|
|
4
4
|
import { WorkerElementAdapter } from './driver/workerElementAdapter';
|
|
5
5
|
import { CameraPath } from '../camera/cameraPath';
|
|
6
|
-
import { iVectorLike, iViewerOption, iViewerMaterialOption, iLoadingOption, iHeaderInfo, iTransform, iSelectorInfo, iPickingInfo, iCameraPathOption, iCameraParameter, tSelectionMode, tMaskSource, tControlsType, tCustomDefines, tCustomUniforms } from './types';
|
|
6
|
+
import { iVectorLike, iViewerOption, iViewerMaterialOption, iLoadingOption, iHeaderInfo, iTransform, iSelectorInfo, iPickingInfo, iSurfaceInfo, iFocusMarkerOption, iCameraPathOption, iCameraParameter, tSelectionMode, tMaskSource, tControlsType, tCustomDefines, tCustomUniforms } from './types';
|
|
7
7
|
import { iCollisionTarget } from '../worker/tavioWorker';
|
|
8
8
|
import { iSphereSelectorOption } from '../editor/selector/sphereSelector';
|
|
9
9
|
import { iBoxSelectorOption } from '../editor/selector/boxSelector';
|
|
10
10
|
import { iCameraSelectorOption } from '../editor/selector/cameraSelector';
|
|
11
|
+
import { iVisibleAreaHelperOption } from '../editor/visibleAreaHelper';
|
|
11
12
|
export declare class Core extends EventEmitter {
|
|
12
13
|
private driver;
|
|
13
14
|
static CHUNK_TARGET: {
|
|
@@ -87,6 +88,12 @@ export declare class Core extends EventEmitter {
|
|
|
87
88
|
saveSpzWasm(name: string, fileName?: string): Promise<any>;
|
|
88
89
|
saveTavioWasm(name: string, fileName?: string, options?: any): Promise<any>;
|
|
89
90
|
exportTavioWasm(name: string, options?: any): Promise<any>;
|
|
91
|
+
/**
|
|
92
|
+
* splat / ply / spz / sog 形式のバイナリデータを取得する。OffscreenCanvas(Worker)で描画している場合も取得できる
|
|
93
|
+
* @param name - このメッシュの固有名
|
|
94
|
+
* @param format - ファイル形式
|
|
95
|
+
*/
|
|
96
|
+
exportMeshWasm(name: string, format: "splat" | "ply" | "spz" | "sog"): Promise<Uint8Array>;
|
|
90
97
|
/**
|
|
91
98
|
* 現在の描画内容を画像として取得する。OffscreenCanvas(Worker)で描画している場合も取得できる
|
|
92
99
|
* @param type - 画像の MIME タイプ [default: "image/png"]
|
|
@@ -108,6 +115,7 @@ export declare class Core extends EventEmitter {
|
|
|
108
115
|
getRenderViewCount(): Promise<number> | number;
|
|
109
116
|
setRenderViewSize(renderViewName?: string | Symbol, x?: number, y?: number, width?: number, height?: number, start?: boolean): void;
|
|
110
117
|
getWorldPositionByRenderView(x: number, y: number, isDebug?: boolean): Promise<iPickingInfo | null> | iPickingInfo | null;
|
|
118
|
+
getSurfaceByRenderView(x: number, y: number, sampleRadius?: number): Promise<iSurfaceInfo | null> | iSurfaceInfo | null;
|
|
111
119
|
setCustomDefines(defines: tCustomDefines): void;
|
|
112
120
|
setCustomUniforms(uniforms: tCustomUniforms): void;
|
|
113
121
|
setGaussianScale(scale: number): void;
|
|
@@ -139,6 +147,9 @@ export declare class Core extends EventEmitter {
|
|
|
139
147
|
startDissolveToGaussian(duration?: number, backgroundFadeInDelay?: number, backgroundFadeInDuration?: number): void;
|
|
140
148
|
startSonarWave(duration?: number): void;
|
|
141
149
|
animatePath(name?: string, duration?: number): void;
|
|
150
|
+
animateCameraTo(position: iVectorLike, target: iVectorLike, duration?: number): void;
|
|
151
|
+
showFocusMarker(position: iVectorLike, normal: iVectorLike, option?: iFocusMarkerOption): void;
|
|
152
|
+
hideFocusMarker(): void;
|
|
142
153
|
startFadeInBackground(duration?: number): void;
|
|
143
154
|
startFadeOutBackground(duration?: number): void;
|
|
144
155
|
applyLocalTransformToSelected(name: string, translation: iVectorLike, rotation: iVectorLike, scale: iVectorLike): void;
|
|
@@ -162,8 +173,18 @@ export declare class Core extends EventEmitter {
|
|
|
162
173
|
setControlsType(controlsType: string): void;
|
|
163
174
|
getControlsType(): Promise<tControlsType> | tControlsType;
|
|
164
175
|
setControlsAttenuation(attenuation: number): void;
|
|
165
|
-
|
|
166
|
-
|
|
176
|
+
/**
|
|
177
|
+
* アクティブなカメラパスを選択する
|
|
178
|
+
* @param name - 選択するカメラパスの名前
|
|
179
|
+
* @param force - 切り替え時にイージング(補間)を行わず、即座に新しいパスの始点へ移動するかどうか [default: false]
|
|
180
|
+
*/
|
|
181
|
+
selectCameraPath(name: string, force?: boolean): void;
|
|
182
|
+
/**
|
|
183
|
+
* カメラパスが有効な場合、指定された時間を設定し更新する
|
|
184
|
+
* @param time - 設定する時間(0.0 ~ 1.0)
|
|
185
|
+
* @param force - イージング(補間)を行わず即座にカメラへ反映するかどうか [default: false]
|
|
186
|
+
*/
|
|
187
|
+
updateCameraPath(time?: number, force?: boolean): void;
|
|
167
188
|
createCameraPath(position: number[][] | iVectorLike[], target: number[][] | iVectorLike[], debug?: boolean, times?: number[] | null): CameraPath | void;
|
|
168
189
|
addCameraPath(name: string, position: number[][] | iVectorLike[], target: number[][] | iVectorLike[], debug?: boolean, times?: number[] | null): void;
|
|
169
190
|
removeCameraPath(name: string): void;
|
|
@@ -251,6 +272,8 @@ export declare class Core extends EventEmitter {
|
|
|
251
272
|
setSelectorColor(name: string, color: number): void;
|
|
252
273
|
setGuideLine(name: string, from: iVectorLike, to: iVectorLike, color?: number): void;
|
|
253
274
|
removeGuideLine(name: string): void;
|
|
275
|
+
setVisibleAreaHelper(name: string, option: iVisibleAreaHelperOption): void;
|
|
276
|
+
removeVisibleAreaHelper(name: string): void;
|
|
254
277
|
pickSelector(ndcX: number, ndcY: number): Promise<string | null> | string | null;
|
|
255
278
|
setSelectorScale(name: string, scale: iVectorLike): void;
|
|
256
279
|
deleteSelector(name: string): void;
|
|
@@ -2,7 +2,8 @@ import { RawShaderMaterial, WebGLRenderTarget, WebGLRenderer, PMREMGenerator, Me
|
|
|
2
2
|
import { iSphereSelectorOption } from '../../editor/selector/sphereSelector';
|
|
3
3
|
import { iBoxSelectorOption } from '../../editor/selector/boxSelector';
|
|
4
4
|
import { iCameraSelectorOption } from '../../editor/selector/cameraSelector';
|
|
5
|
-
import {
|
|
5
|
+
import { iVisibleAreaHelperOption } from '../../editor/visibleAreaHelper';
|
|
6
|
+
import { iSelectorInfo, tControlsType, tMaskSource, tSelectionMode, iVectorLike, iCameraPathOption, iCameraParameter, iViewerOption, iViewerMaterialOption, iLoadingOption, iHeaderInfo, iTransform, iPickingInfo, iSurfaceInfo, iFocusMarkerOption, tUniformValue, tCustomDefines, tCustomUniforms } from '../types';
|
|
6
7
|
import { iCollisionTarget } from '../../worker/tavioWorker';
|
|
7
8
|
import { WorkerElementAdapter } from './workerElementAdapter';
|
|
8
9
|
import { default as EventEmitter } from 'eventemitter3';
|
|
@@ -68,6 +69,8 @@ export declare class CoreDriver extends EventEmitter implements iCoreDriver {
|
|
|
68
69
|
private torusMaterial?;
|
|
69
70
|
private sphereGeometry?;
|
|
70
71
|
private sphereMaterial?;
|
|
72
|
+
private cameraAnimationToken;
|
|
73
|
+
private focusMarker;
|
|
71
74
|
private shaderRegistry;
|
|
72
75
|
/** WebGLRenderer.getSize 用(RenderView は論理ピクセル。canvas バッファ実寸とは別) */
|
|
73
76
|
private readonly _rendererLogicalSize;
|
|
@@ -325,6 +328,12 @@ export declare class CoreDriver extends EventEmitter implements iCoreDriver {
|
|
|
325
328
|
bytes: Uint8Array;
|
|
326
329
|
version: string;
|
|
327
330
|
}>;
|
|
331
|
+
/**
|
|
332
|
+
* splat / ply / spz / sog 形式のバイナリデータを生成する
|
|
333
|
+
* @param name - このメッシュの固有名
|
|
334
|
+
* @param format - ファイル形式
|
|
335
|
+
*/
|
|
336
|
+
exportMeshWasm(name: string, format: Parameters<typeof TavioMesh.prototype.exportMeshWasm>[0]): Promise<Uint8Array>;
|
|
328
337
|
/**
|
|
329
338
|
* 現在の描画内容を画像として取得する
|
|
330
339
|
* preserveDrawingBuffer が無効でも取得できるよう、その場で1フレーム描画し、同じタスク内で
|
|
@@ -547,6 +556,27 @@ export declare class CoreDriver extends EventEmitter implements iCoreDriver {
|
|
|
547
556
|
* @param isDebug - デバッグモード(有効化するとピッキングバッファを可視化)
|
|
548
557
|
*/
|
|
549
558
|
getWorldPositionByRenderView(x: number, y: number, isDebug?: boolean): Promise<iPickingInfo | null>;
|
|
559
|
+
/**
|
|
560
|
+
* getWorldPositionByRenderView と同じくスクリーン座標にある 3DGS のワールド座標を取得し、
|
|
561
|
+
* あわせて周辺のスプラットの位置から推定した面の法線を返す
|
|
562
|
+
* @param x - 取得する X 座標(スクリーン空間を -1.0 ~ 1.0 に正規化した座標)
|
|
563
|
+
* @param y - 取得する Y 座標(スクリーン空間を -1.0 ~ 1.0 に正規化した座標, Y-down)
|
|
564
|
+
* @param sampleRadius - 法線の推定に使う周辺の範囲(ピクセル、デフォルト 8)
|
|
565
|
+
*/
|
|
566
|
+
getSurfaceByRenderView(x: number, y: number, sampleRadius?: number): Promise<iSurfaceInfo | null>;
|
|
567
|
+
/**
|
|
568
|
+
* ピッキング用のレンダーターゲットに、指定したレンダービューから見た 3DGS のワールド座標を描画する
|
|
569
|
+
* @param renderView - 描画するレンダービュー
|
|
570
|
+
* @param alphaThreshold - この不透明度に満たない部分はピッキングの対象にしない(0.0 ならスプラットの矩形全体)
|
|
571
|
+
*/
|
|
572
|
+
private _renderPickingTarget;
|
|
573
|
+
/**
|
|
574
|
+
* ピッキング用のレンダーターゲットから読み出した 1 ピクセル分の値を解釈する
|
|
575
|
+
* @param floatBuffer - 読み出した RGBA の値
|
|
576
|
+
* @param offset - 解釈するピクセルの先頭のインデックス
|
|
577
|
+
* @returns 何も描画されていないピクセルなら null
|
|
578
|
+
*/
|
|
579
|
+
private _resolvePickingPixel;
|
|
550
580
|
/**
|
|
551
581
|
* スクリーン空間上の矩形またはドローイングマスクの範囲にあるスプラットを選択する
|
|
552
582
|
* @param x - 正規化された選択領域の左上 X 座標 (0.0 ~ 1.0)
|
|
@@ -795,8 +825,9 @@ export declare class CoreDriver extends EventEmitter implements iCoreDriver {
|
|
|
795
825
|
/**
|
|
796
826
|
* カメラパスが有効な場合、指定された時間を設定し更新する
|
|
797
827
|
* @param time - 設定する時間(0.0 ~ 1.0)
|
|
828
|
+
* @param force - イージング(補間)を行わず即座にカメラへ反映するかどうか [default: false]
|
|
798
829
|
*/
|
|
799
|
-
updateCameraPath(time: number): void;
|
|
830
|
+
updateCameraPath(time: number, force?: boolean): void;
|
|
800
831
|
/**
|
|
801
832
|
* カメラパスを名前と座標データで追加登録する
|
|
802
833
|
* @param name - カメラパスの識別名
|
|
@@ -821,8 +852,9 @@ export declare class CoreDriver extends EventEmitter implements iCoreDriver {
|
|
|
821
852
|
/**
|
|
822
853
|
* アクティブなカメラパスを選択する
|
|
823
854
|
* @param name - 選択するカメラパスの名前
|
|
855
|
+
* @param force - 切り替え時にイージング(補間)を行わず、即座に新しいパスの始点へ移動するかどうか [default: false]
|
|
824
856
|
*/
|
|
825
|
-
selectCameraPath(name: string): void;
|
|
857
|
+
selectCameraPath(name: string, force?: boolean): void;
|
|
826
858
|
/**
|
|
827
859
|
* 現在アクティブなカメラパスの名前を取得する
|
|
828
860
|
* @returns アクティブなカメラパスの名前、または null
|
|
@@ -1207,6 +1239,27 @@ export declare class CoreDriver extends EventEmitter implements iCoreDriver {
|
|
|
1207
1239
|
* @param duration - アニメーションの継続時間(ミリ秒)
|
|
1208
1240
|
*/
|
|
1209
1241
|
animatePath(name?: string, duration?: number): void;
|
|
1242
|
+
/**
|
|
1243
|
+
* カメラの位置と注視点を、指定した値へ補間しながら移動する
|
|
1244
|
+
* 移動中に再度呼ばれた場合は、その時点の状態から新しい移動に切り替える
|
|
1245
|
+
* 移動が完了すると cameraanimationend イベントを発火する(途中で切り替えられた移動では発火しない)
|
|
1246
|
+
* @param position - 移動先のカメラの位置
|
|
1247
|
+
* @param target - 移動先の注視点
|
|
1248
|
+
* @param duration - アニメーションの継続時間(ミリ秒、デフォルト 800)
|
|
1249
|
+
*/
|
|
1250
|
+
animateCameraTo(position: iVectorLike, target: iVectorLike, duration?: number): void;
|
|
1251
|
+
/**
|
|
1252
|
+
* 注視点を示すマーカー(平面のドーナツ)を、指定した位置に面の向きに合わせて一定時間表示する
|
|
1253
|
+
* 表示中に再度呼ばれた場合は、前のマーカーを消して新しいマーカーを表示する
|
|
1254
|
+
* @param position - 表示する位置
|
|
1255
|
+
* @param normal - ドーナツの面の法線
|
|
1256
|
+
* @param option - 表示オプション
|
|
1257
|
+
*/
|
|
1258
|
+
showFocusMarker(position: iVectorLike, normal: iVectorLike, option?: iFocusMarkerOption): void;
|
|
1259
|
+
/**
|
|
1260
|
+
* showFocusMarker で表示したマーカーを直ちに消す
|
|
1261
|
+
*/
|
|
1262
|
+
hideFocusMarker(): void;
|
|
1210
1263
|
/**
|
|
1211
1264
|
* 背景の不透明度を0から1.0へアニメーションする
|
|
1212
1265
|
* @param duration - アニメーションの継続時間(ミリ秒)
|
|
@@ -1309,6 +1362,7 @@ export declare class CoreDriver extends EventEmitter implements iCoreDriver {
|
|
|
1309
1362
|
setPointUniforms(uniforms: Record<string, tUniformValue>): void;
|
|
1310
1363
|
private selectorMap;
|
|
1311
1364
|
private guideLineMap;
|
|
1365
|
+
private visibleAreaHelperMap;
|
|
1312
1366
|
private reversedCollision;
|
|
1313
1367
|
/**
|
|
1314
1368
|
* セレクターによる衝突判定の反転フラグを設定する
|
|
@@ -1426,6 +1480,18 @@ export declare class CoreDriver extends EventEmitter implements iCoreDriver {
|
|
|
1426
1480
|
* @param name - 削除するガイド線の識別名
|
|
1427
1481
|
*/
|
|
1428
1482
|
removeGuideLine(name: string): void;
|
|
1483
|
+
/**
|
|
1484
|
+
* クロップ領域(表示領域)を、輪郭の線と薄い半透明の面で表示する。同じ名前で呼ぶと形・位置・大きさ・回転・色を更新する。
|
|
1485
|
+
* 表示のみで、セレクターの選択・衝突判定やガウシアンのピッキングには影響しない
|
|
1486
|
+
* @param name - クロップ領域の表示の識別名
|
|
1487
|
+
* @param option - 形・位置・大きさ・回転・色
|
|
1488
|
+
*/
|
|
1489
|
+
setVisibleAreaHelper(name: string, option: iVisibleAreaHelperOption): void;
|
|
1490
|
+
/**
|
|
1491
|
+
* 名前を指定してクロップ領域の表示を削除する
|
|
1492
|
+
* @param name - 削除するクロップ領域の表示の識別名
|
|
1493
|
+
*/
|
|
1494
|
+
removeVisibleAreaHelper(name: string): void;
|
|
1429
1495
|
/**
|
|
1430
1496
|
* 画面上の位置(正規化デバイス座標)からレイを飛ばし、最初に当たる表示中のセレクターの名前を返す。
|
|
1431
1497
|
* 各セレクターを包む境界球で判定し、遠くにある小さなセレクターでもクリックしやすいよう、
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { default as EventEmitter } from 'eventemitter3';
|
|
2
|
-
import { iViewerOption, iViewerMaterialOption, iLoadingOption, iHeaderInfo, iTransform, iVectorLike, iSelectorInfo, iPickingInfo, iCameraPathOption, iCameraParameter, tSelectionMode, tMaskSource, tControlsType, tUniformValue, tCustomDefines, tCustomUniforms } from '../types';
|
|
2
|
+
import { iViewerOption, iViewerMaterialOption, iLoadingOption, iHeaderInfo, iTransform, iVectorLike, iSelectorInfo, iPickingInfo, iSurfaceInfo, iFocusMarkerOption, iCameraPathOption, iCameraParameter, tSelectionMode, tMaskSource, tControlsType, tUniformValue, tCustomDefines, tCustomUniforms } from '../types';
|
|
3
3
|
import { iCollisionTarget } from '../../worker/tavioWorker';
|
|
4
4
|
import { iSphereSelectorOption } from '../../editor/selector/sphereSelector';
|
|
5
5
|
import { iBoxSelectorOption } from '../../editor/selector/boxSelector';
|
|
6
6
|
import { iCameraSelectorOption } from '../../editor/selector/cameraSelector';
|
|
7
|
+
import { iVisibleAreaHelperOption } from '../../editor/visibleAreaHelper';
|
|
7
8
|
import { MeshStandardMaterialParameters } from 'three';
|
|
8
9
|
import { iLatitudeLongitude } from '../../camera/flightControls';
|
|
9
10
|
import { WorkerElementAdapter } from './workerElementAdapter';
|
|
@@ -58,6 +59,7 @@ export interface iCoreDriver extends EventEmitter {
|
|
|
58
59
|
saveSpzWasm(name: string, fileName?: string): Promise<any>;
|
|
59
60
|
saveTavioWasm(name: string, fileName?: string, options?: any): Promise<any>;
|
|
60
61
|
exportTavioWasm(name: string, options?: any): Promise<any>;
|
|
62
|
+
exportMeshWasm(name: string, format: "splat" | "ply" | "spz" | "sog"): Promise<Uint8Array>;
|
|
61
63
|
/**
|
|
62
64
|
* 現在の描画内容を画像として取得する(描画内容の画像化・サムネイル生成用)
|
|
63
65
|
* @param type - 画像の MIME タイプ [default: "image/png"]
|
|
@@ -79,6 +81,7 @@ export interface iCoreDriver extends EventEmitter {
|
|
|
79
81
|
getRenderViewCount(): Promise<number> | number;
|
|
80
82
|
setRenderViewSize(renderViewName?: string | Symbol, x?: number, y?: number, width?: number, height?: number, start?: boolean): void;
|
|
81
83
|
getWorldPositionByRenderView(x: number, y: number, isDebug?: boolean): Promise<iPickingInfo | null> | iPickingInfo | null;
|
|
84
|
+
getSurfaceByRenderView(x: number, y: number, sampleRadius?: number): Promise<iSurfaceInfo | null> | iSurfaceInfo | null;
|
|
82
85
|
setUniforms(uniforms: Record<string, tUniformValue>): void;
|
|
83
86
|
setPointUniforms(uniforms: Record<string, tUniformValue>): void;
|
|
84
87
|
setCustomDefines(defines: tCustomDefines): void;
|
|
@@ -112,6 +115,9 @@ export interface iCoreDriver extends EventEmitter {
|
|
|
112
115
|
startDissolveToGaussian(duration?: number, backgroundFadeInDelay?: number, backgroundFadeInDuration?: number): void;
|
|
113
116
|
startSonarWave(duration?: number): void;
|
|
114
117
|
animatePath(name?: string, duration?: number): void;
|
|
118
|
+
animateCameraTo(position: iVectorLike, target: iVectorLike, duration?: number): void;
|
|
119
|
+
showFocusMarker(position: iVectorLike, normal: iVectorLike, option?: iFocusMarkerOption): void;
|
|
120
|
+
hideFocusMarker(): void;
|
|
115
121
|
startFadeInBackground(duration?: number): void;
|
|
116
122
|
startFadeOutBackground(duration?: number): void;
|
|
117
123
|
setOrbitCursorAutoDisplay(enabled: boolean): void;
|
|
@@ -142,8 +148,8 @@ export interface iCoreDriver extends EventEmitter {
|
|
|
142
148
|
setControlsType(controlsType: string): void;
|
|
143
149
|
getControlsType(): Promise<tControlsType> | tControlsType;
|
|
144
150
|
setControlsAttenuation(attenuation: number): void;
|
|
145
|
-
selectCameraPath(name: string): void;
|
|
146
|
-
updateCameraPath(time?: number): void;
|
|
151
|
+
selectCameraPath(name: string, force?: boolean): void;
|
|
152
|
+
updateCameraPath(time?: number, force?: boolean): void;
|
|
147
153
|
createCameraPath(position: number[][] | iVectorLike[], target: number[][] | iVectorLike[], debug?: boolean, times?: number[] | null): CameraPath | void;
|
|
148
154
|
/** times: 各制御点に対応する時刻(0.0 ~ 1.0)。省略時は等間隔 */
|
|
149
155
|
addCameraPath(name: string, position: number[][] | iVectorLike[], target: number[][] | iVectorLike[], debug?: boolean, times?: number[] | null): void;
|
|
@@ -231,6 +237,10 @@ export interface iCoreDriver extends EventEmitter {
|
|
|
231
237
|
setGuideLine(name: string, from: iVectorLike, to: iVectorLike, color?: number): void;
|
|
232
238
|
/** 編集用のガイド線を削除する */
|
|
233
239
|
removeGuideLine(name: string): void;
|
|
240
|
+
/** クロップ領域(表示領域)を輪郭の線と薄い半透明の面で表示する。同じ名前で呼ぶと更新する */
|
|
241
|
+
setVisibleAreaHelper(name: string, option: iVisibleAreaHelperOption): void;
|
|
242
|
+
/** クロップ領域の表示を削除する */
|
|
243
|
+
removeVisibleAreaHelper(name: string): void;
|
|
234
244
|
/** 画面上の位置(正規化デバイス座標)にある、表示中のセレクターの名前を返す(無ければnull) */
|
|
235
245
|
pickSelector(ndcX: number, ndcY: number): Promise<string | null> | string | null;
|
|
236
246
|
setSelectorScale(name: string, scale: iVectorLike): void;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { default as EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { iCoreDriver } from './iCoreDriver';
|
|
3
|
-
import { iViewerOption, iViewerMaterialOption, iLoadingOption, iHeaderInfo, iTransform, iVectorLike, iSelectorInfo, iPickingInfo, iCameraPathOption, iCameraParameter, tSelectionMode, tMaskSource, tControlsType, tUniformValue, tCustomDefines, tCustomUniforms } from '../types';
|
|
3
|
+
import { iViewerOption, iViewerMaterialOption, iLoadingOption, iHeaderInfo, iTransform, iVectorLike, iSelectorInfo, iPickingInfo, iSurfaceInfo, iFocusMarkerOption, iCameraPathOption, iCameraParameter, tSelectionMode, tMaskSource, tControlsType, tUniformValue, tCustomDefines, tCustomUniforms } from '../types';
|
|
4
4
|
import { iCollisionTarget } from '../../worker/tavioWorker';
|
|
5
5
|
import { iLatitudeLongitude } from '../../camera/flightControls';
|
|
6
6
|
import { iSphereSelectorOption } from '../../editor/selector/sphereSelector';
|
|
7
7
|
import { iBoxSelectorOption } from '../../editor/selector/boxSelector';
|
|
8
8
|
import { iCameraSelectorOption } from '../../editor/selector/cameraSelector';
|
|
9
|
+
import { iVisibleAreaHelperOption } from '../../editor/visibleAreaHelper';
|
|
9
10
|
import { MeshStandardMaterialParameters } from 'three';
|
|
10
11
|
import { WorkerElementAdapter } from './workerElementAdapter';
|
|
11
12
|
/**
|
|
@@ -59,6 +60,9 @@ export declare class OffscreenDriver extends EventEmitter implements iCoreDriver
|
|
|
59
60
|
startDissolveToGaussian(duration?: number, backgroundFadeInDelay?: number, backgroundFadeInDuration?: number): void;
|
|
60
61
|
startSonarWave(duration?: number): void;
|
|
61
62
|
animatePath(name?: string, duration?: number): void;
|
|
63
|
+
animateCameraTo(position: iVectorLike, target: iVectorLike, duration?: number): void;
|
|
64
|
+
showFocusMarker(position: iVectorLike, normal: iVectorLike, option?: iFocusMarkerOption): void;
|
|
65
|
+
hideFocusMarker(): void;
|
|
62
66
|
startFadeInBackground(duration?: number): void;
|
|
63
67
|
startFadeOutBackground(duration?: number): void;
|
|
64
68
|
applyLocalTransformToSelected(name: string, translation: iVectorLike, rotation: iVectorLike, scale: iVectorLike): void;
|
|
@@ -111,8 +115,8 @@ export declare class OffscreenDriver extends EventEmitter implements iCoreDriver
|
|
|
111
115
|
setCameraParameter(position?: number[] | iVectorLike, target?: number[] | iVectorLike, fov?: number): void;
|
|
112
116
|
setControlsType(controlsType: string): void;
|
|
113
117
|
getControlsType(): Promise<tControlsType>;
|
|
114
|
-
selectCameraPath(name: string): void;
|
|
115
|
-
updateCameraPath(time?: number): void;
|
|
118
|
+
selectCameraPath(name: string, force?: boolean): void;
|
|
119
|
+
updateCameraPath(time?: number, force?: boolean): void;
|
|
116
120
|
setOrbitPointerDown(isDown: boolean): void;
|
|
117
121
|
setOrbitRelativeRotateLeft(value: number): void;
|
|
118
122
|
setOrbitRelativeRotateUp(value: number): void;
|
|
@@ -138,11 +142,12 @@ export declare class OffscreenDriver extends EventEmitter implements iCoreDriver
|
|
|
138
142
|
setSpotLightDecay(decay: number): void;
|
|
139
143
|
addSpotLight(position: iVectorLike, target: iVectorLike, color: number, intensity: number, distance: number, angle: number, penumbra: number, decay: number, castShadow?: boolean, isDebug?: boolean): void;
|
|
140
144
|
addWhiteCube(position?: iVectorLike, scale?: iVectorLike, receiveShadow?: boolean, materialOption?: MeshStandardMaterialParameters): void;
|
|
141
|
-
saveSplatWasm(name: string, fileName?: string): Promise<
|
|
142
|
-
savePlyWasm(name: string, fileName?: string): Promise<
|
|
143
|
-
saveSpzWasm(name: string, fileName?: string): Promise<
|
|
144
|
-
saveTavioWasm(name: string, fileName?: string, options?: any): Promise<
|
|
145
|
+
saveSplatWasm(name: string, fileName?: string): Promise<void>;
|
|
146
|
+
savePlyWasm(name: string, fileName?: string): Promise<void>;
|
|
147
|
+
saveSpzWasm(name: string, fileName?: string): Promise<void>;
|
|
148
|
+
saveTavioWasm(name: string, fileName?: string, options?: any): Promise<void>;
|
|
145
149
|
exportTavioWasm(name: string, options?: any): Promise<any>;
|
|
150
|
+
exportMeshWasm(name: string, format: "splat" | "ply" | "spz" | "sog"): Promise<Uint8Array>;
|
|
146
151
|
/**
|
|
147
152
|
* Worker 内の OffscreenCanvas で描画した内容を画像として取得する
|
|
148
153
|
* (Blob は構造化複製で Worker からメインスレッドへ返る)
|
|
@@ -155,6 +160,7 @@ export declare class OffscreenDriver extends EventEmitter implements iCoreDriver
|
|
|
155
160
|
getCurrentRenderViewName(): Promise<string | null>;
|
|
156
161
|
setRenderViewSize(renderViewName?: string | Symbol, x?: number, y?: number, width?: number, height?: number, start?: boolean): void;
|
|
157
162
|
getWorldPositionByRenderView(x: number, y: number, isDebug?: boolean): Promise<iPickingInfo | null>;
|
|
163
|
+
getSurfaceByRenderView(x: number, y: number, sampleRadius?: number): Promise<iSurfaceInfo | null>;
|
|
158
164
|
setCustomDefines(defines: tCustomDefines): void;
|
|
159
165
|
setCustomUniforms(uniforms: tCustomUniforms): void;
|
|
160
166
|
setGaussianScale(scale: number): void;
|
|
@@ -239,6 +245,8 @@ export declare class OffscreenDriver extends EventEmitter implements iCoreDriver
|
|
|
239
245
|
setSelectorColor(name: string, color: number): void;
|
|
240
246
|
setGuideLine(name: string, from: iVectorLike, to: iVectorLike, color?: number): void;
|
|
241
247
|
removeGuideLine(name: string): void;
|
|
248
|
+
setVisibleAreaHelper(name: string, option: iVisibleAreaHelperOption): void;
|
|
249
|
+
removeVisibleAreaHelper(name: string): void;
|
|
242
250
|
pickSelector(ndcX: number, ndcY: number): Promise<string | null>;
|
|
243
251
|
setSelectorScale(name: string, scale: iVectorLike): void;
|
|
244
252
|
deleteSelector(name: string): void;
|
|
@@ -254,11 +254,17 @@ export declare class TavioMesh extends EventEmitter {
|
|
|
254
254
|
*/
|
|
255
255
|
saveTavioWasm(filename: string, options?: Parameters<typeof TavioMesh.prototype.exportTavioWasm>[0]): Promise<void>;
|
|
256
256
|
/**
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
* 様々な形式のリソースをセーブする
|
|
258
|
+
* @param filename - 保存ファイル名
|
|
259
259
|
* @param format - ファイル形式
|
|
260
260
|
*/
|
|
261
261
|
saveMeshWasm(filename: string, format: "splat" | "ply" | "spz" | "sog"): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* 様々な形式のバイナリデータを生成する
|
|
264
|
+
* ダウンロードは行わないため、DOM の無い Worker(OffscreenCanvas)でも使用できる
|
|
265
|
+
* @param format - ファイル形式
|
|
266
|
+
*/
|
|
267
|
+
exportMeshWasm(format: "splat" | "ply" | "spz" | "sog"): Promise<Uint8Array>;
|
|
262
268
|
/**
|
|
263
269
|
* ==========================================================================
|
|
264
270
|
* getter / setter
|
|
@@ -470,6 +476,11 @@ export declare class TavioMesh extends EventEmitter {
|
|
|
470
476
|
* @param camera - 対象となるカメラ
|
|
471
477
|
*/
|
|
472
478
|
syncPinckingMaterial(camera: PerspectiveCamera): void;
|
|
479
|
+
/**
|
|
480
|
+
* picking 用マテリアルで、ピッキングの対象にする不透明度の下限を設定する
|
|
481
|
+
* @param threshold - この不透明度に満たない部分は対象にしない(0.0 ならスプラットの矩形全体が対象)
|
|
482
|
+
*/
|
|
483
|
+
setPickingAlphaThreshold(threshold: number): void;
|
|
473
484
|
/**
|
|
474
485
|
* shadowing 用マテリアルに uniform 変数を同期する
|
|
475
486
|
*/
|
|
@@ -196,6 +196,26 @@ export interface iPickingInfo {
|
|
|
196
196
|
index: number;
|
|
197
197
|
target: iVectorLike;
|
|
198
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* ピッキングした位置の面の情報
|
|
201
|
+
*/
|
|
202
|
+
export interface iSurfaceInfo extends iPickingInfo {
|
|
203
|
+
/** 周辺のスプラットから推定した面の法線(正規化済み、カメラ側を向く) */
|
|
204
|
+
normal: iVectorLike;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* 注視点を示すマーカー(平面のドーナツ)の表示オプション
|
|
208
|
+
*/
|
|
209
|
+
export interface iFocusMarkerOption {
|
|
210
|
+
/** 表示時間(ミリ秒、デフォルト 1500)。広がりながら後半でフェードアウトする */
|
|
211
|
+
duration?: number;
|
|
212
|
+
/** 広がりきったときの外径(ワールド単位、デフォルト 0.05)。中心から広がる */
|
|
213
|
+
radius?: number;
|
|
214
|
+
/** 表示開始時の太さ(外径に対する比率 0.0 ~ 1.0、デフォルト 0.3)。表示の終わりに向けて 0 まで細くなる */
|
|
215
|
+
thickness?: number;
|
|
216
|
+
/** 色(デフォルト 0xffffff) */
|
|
217
|
+
color?: number;
|
|
218
|
+
}
|
|
199
219
|
/**
|
|
200
220
|
* ビューポートや focal の情報
|
|
201
221
|
*/
|
|
@@ -15,7 +15,7 @@ export type WasmWorkerUpdateMessage = {
|
|
|
15
15
|
export declare function wasmBuildSourceProperty(event: WasmDecodeHeaderEvent, sourceIndex: number, sourceVertexOffset: number): {
|
|
16
16
|
ready: boolean;
|
|
17
17
|
index: number;
|
|
18
|
-
type: "
|
|
18
|
+
type: "splat" | "ply" | "spz" | "sog" | "tavio";
|
|
19
19
|
vertexCount: number;
|
|
20
20
|
vertexOffset: number;
|
|
21
21
|
featureBits: number;
|
|
@@ -9,6 +9,14 @@ export declare const setWasmBinaryUrls: (urls: {
|
|
|
9
9
|
thread?: string;
|
|
10
10
|
noThread?: string;
|
|
11
11
|
}) => void;
|
|
12
|
+
/**
|
|
13
|
+
* wasmバイナリの配信元ベースURLを外部から指定する。
|
|
14
|
+
* バンドラーによる `new URL(..., import.meta.url)` の解決に依存せず、
|
|
15
|
+
* アプリケーション側で `wasm/pkg` の配信先を明示したい場合に使う。
|
|
16
|
+
* TavioMesh を読み込む前に呼び出すこと。
|
|
17
|
+
* @param baseUrl - `thread/tavio_bg.wasm` / `no-thread/tavio_bg.wasm` を含むディレクトリ(`wasm/pkg`相当)のURL
|
|
18
|
+
*/
|
|
19
|
+
export declare const setWasmBaseUrl: (baseUrl: string) => void;
|
|
12
20
|
export interface ResolvedGaussianEdits {
|
|
13
21
|
pointCount: number;
|
|
14
22
|
gaussianData: Uint8Array;
|