@openheart/tavio-renderer 2.2.9-without-wasm
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/README.md +25 -0
- package/build/esm/index.js +41928 -0
- package/build/esm/types/animation/animationController.d.ts +133 -0
- package/build/esm/types/camera/cameraCollider.d.ts +54 -0
- package/build/esm/types/camera/cameraPath.d.ts +120 -0
- package/build/esm/types/camera/cameraPathControls.d.ts +73 -0
- package/build/esm/types/camera/cameraPathManager.d.ts +67 -0
- package/build/esm/types/camera/flightControls.d.ts +76 -0
- package/build/esm/types/camera/orbitControls.d.ts +192 -0
- package/build/esm/types/camera/transferControls.d.ts +122 -0
- package/build/esm/types/editor/selector/boxSelector.d.ts +45 -0
- package/build/esm/types/editor/selector/selector.d.ts +145 -0
- package/build/esm/types/editor/selector/sphereSelector.d.ts +45 -0
- package/build/esm/types/extension/InstancedMeshEX.d.ts +101 -0
- package/build/esm/types/global.iife.d.ts +9 -0
- package/build/esm/types/loader/streamLoader.d.ts +21 -0
- package/build/esm/types/main.d.ts +0 -0
- package/build/esm/types/math/easing.d.ts +18 -0
- package/build/esm/types/math/interpolation.d.ts +70 -0
- package/build/esm/types/module.d.ts +5 -0
- package/build/esm/types/types/global.d.ts +23 -0
- package/build/esm/types/utility/console.d.ts +6 -0
- package/build/esm/types/utility/plyDecoder.d.ts +97 -0
- package/build/esm/types/utility/utility.d.ts +47 -0
- package/build/esm/types/viewer/canvas.d.ts +1108 -0
- package/build/esm/types/viewer/tavioMesh.d.ts +436 -0
- package/build/esm/types/wasm-bindings/wasm-worker-client.d.ts +57 -0
- package/build/esm/types/wasm-bindings/wasm-worker.d.ts +49 -0
- package/build/esm/types/wasm-bindings/wasm.d.ts +5 -0
- package/build/esm/types/worker/splatWorker.d.ts +16 -0
- package/build/esm/types/worker/tavioWorker.d.ts +61 -0
- package/package.json +46 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { PerspectiveCamera, Vector3 } from 'three';
|
|
2
|
+
import { default as EventEmitter } from 'eventemitter3';
|
|
3
|
+
interface iOrbitState {
|
|
4
|
+
position: Vector3;
|
|
5
|
+
target: Vector3;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* カメラを中心に首振りや仰角方向の視線制御を可能とするカメラコントロール
|
|
9
|
+
* @class
|
|
10
|
+
*/
|
|
11
|
+
export declare class OrbitControls extends EventEmitter {
|
|
12
|
+
private camera;
|
|
13
|
+
private attenuation;
|
|
14
|
+
private state;
|
|
15
|
+
private center;
|
|
16
|
+
private centerChanged;
|
|
17
|
+
private targetDistance;
|
|
18
|
+
private distanceRange;
|
|
19
|
+
private relativeDistance;
|
|
20
|
+
private currentTheta;
|
|
21
|
+
private targetTheta;
|
|
22
|
+
private thetaRange;
|
|
23
|
+
private relativeTheta;
|
|
24
|
+
private currentPhi;
|
|
25
|
+
private targetPhi;
|
|
26
|
+
private phiRange;
|
|
27
|
+
private relativePhi;
|
|
28
|
+
private relativeTranslation;
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
enableZoom: boolean;
|
|
31
|
+
enablePan: boolean;
|
|
32
|
+
enableLimit: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 範囲を制限する処理では、東西南北のそれぞれの方向に対して制限範囲を設定できる
|
|
35
|
+
* カメラが北極方向に近づく北緯方向を上、向かって左に流れていく方向を西経方向とする
|
|
36
|
+
* syncLimitBase() が呼ばれた際、その瞬間の注視点と位置の関係を制限の基準として limitBase に保持する
|
|
37
|
+
* 制限範囲とは別に、バウンスするような処理を行うために overflow というプロパティがあり……
|
|
38
|
+
* overflow の値(最大まではみ出した距離)までが、設定された制限範囲内に収まるように振る舞う
|
|
39
|
+
* たとえば upOver が 3.0 で overflow が 0.5 の場合、カメラは 2.5 の範囲までは普通に動き……
|
|
40
|
+
* 最後の 2.5 ~ 3.0 の範囲は引っ張られるようなバウンスの挙動が発生するようになる
|
|
41
|
+
* =====
|
|
42
|
+
* バウンスの挙動は「ユーザーが指・マウスボタンを離した際にバウンスして元に戻る」という動きなので……
|
|
43
|
+
* どうしても、絶対に「ユーザーがボタンを押した・離した」を契機に処理を変化させる必要が生じる
|
|
44
|
+
* イベントは一番上の制御層(main.ts)で定義されるため、その実装側から通知してもらう必要がある点に注意
|
|
45
|
+
* ※ setPointerDown() を呼び出してもらう必要がある
|
|
46
|
+
*/
|
|
47
|
+
private limitBase;
|
|
48
|
+
private upLimit;
|
|
49
|
+
private downLimit;
|
|
50
|
+
private leftLimit;
|
|
51
|
+
private rightLimit;
|
|
52
|
+
private isDown;
|
|
53
|
+
private overflow;
|
|
54
|
+
private upOver;
|
|
55
|
+
private downOver;
|
|
56
|
+
private leftOver;
|
|
57
|
+
private rightOver;
|
|
58
|
+
private _temp;
|
|
59
|
+
private _axisX;
|
|
60
|
+
private _axisY;
|
|
61
|
+
private _quatX;
|
|
62
|
+
private _quatY;
|
|
63
|
+
static EVENTS: string[];
|
|
64
|
+
/**
|
|
65
|
+
* @constructor
|
|
66
|
+
* @param camera - 制御の対象となるカメラ
|
|
67
|
+
*/
|
|
68
|
+
constructor(camera: PerspectiveCamera);
|
|
69
|
+
/**
|
|
70
|
+
* 現在の視線から theta と phi を計算する
|
|
71
|
+
*/
|
|
72
|
+
private _getTP;
|
|
73
|
+
/**
|
|
74
|
+
* 大きなラジアンをクランプする
|
|
75
|
+
* @param value - 処理対象となる値
|
|
76
|
+
*/
|
|
77
|
+
private _clampRadians;
|
|
78
|
+
/**
|
|
79
|
+
* オーバーフロー(バウンス)の計算を行う
|
|
80
|
+
* @param value - 現在の範囲外への超過量(this.xxxxOver)
|
|
81
|
+
* @param overflow - 範囲外へ超過できる最大量(this.overflow)
|
|
82
|
+
*/
|
|
83
|
+
private _calcOverflow;
|
|
84
|
+
/**
|
|
85
|
+
* 自身にカメラを設定する
|
|
86
|
+
* @param camera - 制御の対象となるカメラ
|
|
87
|
+
*/
|
|
88
|
+
setCamera(camera: PerspectiveCamera): void;
|
|
89
|
+
/**
|
|
90
|
+
* 減衰係数を設定する
|
|
91
|
+
* @param attenuation - 減衰(0.0 ~ 1.0 未満)
|
|
92
|
+
*/
|
|
93
|
+
setAttenuation(attenuation: number): void;
|
|
94
|
+
/**
|
|
95
|
+
* 注視点の情報を返す
|
|
96
|
+
*/
|
|
97
|
+
getTarget(): Vector3;
|
|
98
|
+
/**
|
|
99
|
+
* 注視点を設定し、内部の theta および phi を更新する
|
|
100
|
+
* @param value - 設定する座標を意味する Vector3
|
|
101
|
+
* @param silent - イベントを発火するフラグを立てるかどうか
|
|
102
|
+
*/
|
|
103
|
+
setTarget(value: Vector3, silent?: boolean): void;
|
|
104
|
+
/**
|
|
105
|
+
* 設定されているカメラの情報を各プロパティに反映する
|
|
106
|
+
*/
|
|
107
|
+
syncCameraParameter(): void;
|
|
108
|
+
/**
|
|
109
|
+
* 注視点とカメラの距離を返す
|
|
110
|
+
*/
|
|
111
|
+
getDistance(): number;
|
|
112
|
+
/**
|
|
113
|
+
* 注視点とカメラの距離を設定する
|
|
114
|
+
*/
|
|
115
|
+
setDistance(distance: number): void;
|
|
116
|
+
/**
|
|
117
|
+
* 前後移動(相対指定)
|
|
118
|
+
* @param value - 距離
|
|
119
|
+
*/
|
|
120
|
+
dollyOut(value: number): void;
|
|
121
|
+
/**
|
|
122
|
+
* 上下回転(相対指定)
|
|
123
|
+
* @param radians - ラジアン
|
|
124
|
+
*/
|
|
125
|
+
rotateUp(radians: number): void;
|
|
126
|
+
/**
|
|
127
|
+
* 左右回転(相対指定)
|
|
128
|
+
* @param radians - ラジアン
|
|
129
|
+
*/
|
|
130
|
+
rotateLeft(radians: number): void;
|
|
131
|
+
/**
|
|
132
|
+
* 上下移動(相対指定)
|
|
133
|
+
* @param value - 移動量(ワールド空間)
|
|
134
|
+
*/
|
|
135
|
+
translateUp(value: number): void;
|
|
136
|
+
/**
|
|
137
|
+
* 左右移動(相対指定)
|
|
138
|
+
* @param value - 移動量(ワールド空間)
|
|
139
|
+
*/
|
|
140
|
+
translateLeft(value: number): void;
|
|
141
|
+
/**
|
|
142
|
+
* 可動範囲の基準となる向きを現在の回転の状態から同期する
|
|
143
|
+
*/
|
|
144
|
+
syncLimitBase(): void;
|
|
145
|
+
/**
|
|
146
|
+
* ポインターが押し込まれているかどうかのフラグを設定する
|
|
147
|
+
* @param isDown - 押し込まれているかどうかを意味する真偽値
|
|
148
|
+
*/
|
|
149
|
+
setPointerDown(isDown: boolean): void;
|
|
150
|
+
/**
|
|
151
|
+
* 可動範囲外へはみ出すことができる範囲を指定する
|
|
152
|
+
* @param overflow - 設定する値
|
|
153
|
+
*/
|
|
154
|
+
setOverflow(overflow: number): void;
|
|
155
|
+
/**
|
|
156
|
+
* 北緯方向の可動範囲(最大 0.5 PI)
|
|
157
|
+
* @param value - 設定する値
|
|
158
|
+
*/
|
|
159
|
+
setUpLimit(value: number): void;
|
|
160
|
+
/**
|
|
161
|
+
* 南緯方向の可動範囲(最大 0.5 PI)
|
|
162
|
+
* @param value - 設定する値
|
|
163
|
+
*/
|
|
164
|
+
setDownLimit(value: number): void;
|
|
165
|
+
/**
|
|
166
|
+
* 西経方向の可動範囲(最大 1.0 PI)
|
|
167
|
+
* @param value - 設定する値
|
|
168
|
+
*/
|
|
169
|
+
setLeftLimit(value: number): void;
|
|
170
|
+
/**
|
|
171
|
+
* 東経方向の可動範囲(最大 1.0 PI)
|
|
172
|
+
* @param value - 設定する値
|
|
173
|
+
*/
|
|
174
|
+
setRightLimit(value: number): void;
|
|
175
|
+
/**
|
|
176
|
+
* 状態を更新し、変更があったかどうかを真偽値で返す
|
|
177
|
+
*/
|
|
178
|
+
update(): boolean;
|
|
179
|
+
/**
|
|
180
|
+
* 保存されたステート(のコピー)を返す
|
|
181
|
+
*/
|
|
182
|
+
getState(): iOrbitState;
|
|
183
|
+
/**
|
|
184
|
+
* 現在のステートを保存する
|
|
185
|
+
*/
|
|
186
|
+
saveState(): void;
|
|
187
|
+
/**
|
|
188
|
+
* 保存されたステートを設定する
|
|
189
|
+
*/
|
|
190
|
+
restoreState(): void;
|
|
191
|
+
}
|
|
192
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { PerspectiveCamera, Quaternion, Vector2, Vector3 } from 'three';
|
|
2
|
+
import { default as EventEmitter } from 'eventemitter3';
|
|
3
|
+
/**
|
|
4
|
+
* カメラの平行移動を行うためのコントロール
|
|
5
|
+
* @class
|
|
6
|
+
*/
|
|
7
|
+
export declare class TransferControls extends EventEmitter {
|
|
8
|
+
private camera;
|
|
9
|
+
private attenuation;
|
|
10
|
+
private currentPosition;
|
|
11
|
+
private targetPosition;
|
|
12
|
+
private currentRotation;
|
|
13
|
+
private targetRotation;
|
|
14
|
+
private latestRotation;
|
|
15
|
+
private currentFov;
|
|
16
|
+
private targetFov;
|
|
17
|
+
private rotationTimeValue;
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
translationEnabled: boolean;
|
|
20
|
+
rotationEnabled: boolean;
|
|
21
|
+
fovEnabled: boolean;
|
|
22
|
+
static EVENTS: string[];
|
|
23
|
+
/**
|
|
24
|
+
* @constructor
|
|
25
|
+
* @param camera - 制御の対象となるカメラ
|
|
26
|
+
*/
|
|
27
|
+
constructor(camera: PerspectiveCamera);
|
|
28
|
+
/**
|
|
29
|
+
* 現在の視線を XZ 平面に投影し正規化したベクトルを返す
|
|
30
|
+
*/
|
|
31
|
+
private _getHorizontalEyeDirection;
|
|
32
|
+
/**
|
|
33
|
+
* 自身にカメラを設定する
|
|
34
|
+
* @param camera - 制御の対象となるカメラ
|
|
35
|
+
*/
|
|
36
|
+
setCamera(camera: PerspectiveCamera): void;
|
|
37
|
+
/**
|
|
38
|
+
* 設定されているカメラの座標を各プロパティに反映する
|
|
39
|
+
*/
|
|
40
|
+
syncCameraPosition(): void;
|
|
41
|
+
/**
|
|
42
|
+
* 設定されているカメラの回転を各プロパティに反映する
|
|
43
|
+
*/
|
|
44
|
+
syncCameraRotation(): void;
|
|
45
|
+
/**
|
|
46
|
+
* 設定されているカメラの FOV を各プロパティに反映する
|
|
47
|
+
*/
|
|
48
|
+
syncCameraFov(): void;
|
|
49
|
+
/**
|
|
50
|
+
* 設定されているカメラの情報を各プロパティに反映する
|
|
51
|
+
*/
|
|
52
|
+
syncCameraParameter(): void;
|
|
53
|
+
/**
|
|
54
|
+
* 減衰係数を設定する
|
|
55
|
+
* @param attenuation - 減衰(0.0 ~ 1.0 未満)
|
|
56
|
+
*/
|
|
57
|
+
setAttenuation(attenuation: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* 最後に適用した回転を返す
|
|
60
|
+
*/
|
|
61
|
+
getLatestRotation(): Quaternion;
|
|
62
|
+
/**
|
|
63
|
+
* 位置を設定する
|
|
64
|
+
* @param position - 位置
|
|
65
|
+
* @param force - 補間を待たずに即座に反映するかどうか
|
|
66
|
+
*/
|
|
67
|
+
setPosition(position: Vector3, force?: boolean): void;
|
|
68
|
+
/**
|
|
69
|
+
* 回転を設定する
|
|
70
|
+
* @param rotation - 回転
|
|
71
|
+
* @param force - 補間を待たずに即座に反映するかどうか
|
|
72
|
+
*/
|
|
73
|
+
setRotation(rotation: Quaternion, force?: boolean): void;
|
|
74
|
+
/**
|
|
75
|
+
* fov を設定する
|
|
76
|
+
* @param fov - 視野角(度数)
|
|
77
|
+
* @param force - 補間を待たずに即座に反映するかどうか
|
|
78
|
+
*/
|
|
79
|
+
setFov(fov: number, force?: boolean): void;
|
|
80
|
+
/**
|
|
81
|
+
* カメラの向きを基準に移動する
|
|
82
|
+
* @param direction - 移動する方向(XY を XZ として解釈)
|
|
83
|
+
* @param scale - 移動するスケール
|
|
84
|
+
* @param force - 補間を待たずに即座に反映するかどうか
|
|
85
|
+
*/
|
|
86
|
+
moveByDirection(direction: Vector3, scale: number, force?: boolean): void;
|
|
87
|
+
/**
|
|
88
|
+
* 現在の向きを考慮して前進する
|
|
89
|
+
* @param direction - 移動する方向(XY を XZ として解釈)
|
|
90
|
+
* @param scale - 移動するスケール
|
|
91
|
+
* @param force - 補間を待たずに即座に反映するかどうか
|
|
92
|
+
*/
|
|
93
|
+
moveByHorizontalDirection(direction: Vector2, scale: number, force?: boolean): void;
|
|
94
|
+
/**
|
|
95
|
+
* Y 軸に垂直な負の方向へ移動する(ワールド空間は原則 Y-down なので見た目上の上方向)
|
|
96
|
+
* @param scale - 移動するスケール
|
|
97
|
+
* @param force - 補間を待たずに即座に反映するかどうか
|
|
98
|
+
*/
|
|
99
|
+
moveToTop(scale: number, force?: boolean): void;
|
|
100
|
+
/**
|
|
101
|
+
* Y 軸に垂直な正の方向へ移動する(ワールド空間は原則 Y-down なので見た目上の下方向)
|
|
102
|
+
* @param scale - 移動するスケール
|
|
103
|
+
* @param force - 補間を待たずに即座に反映するかどうか
|
|
104
|
+
*/
|
|
105
|
+
moveToBottom(scale: number, force?: boolean): void;
|
|
106
|
+
/**
|
|
107
|
+
* 状態を更新し、変更があったかどうかを真偽値で返す
|
|
108
|
+
*/
|
|
109
|
+
update(): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* 位置の状態を更新する
|
|
112
|
+
*/
|
|
113
|
+
private _updatePosition;
|
|
114
|
+
/**
|
|
115
|
+
* 回転の状態を更新する
|
|
116
|
+
*/
|
|
117
|
+
private _updateRotation;
|
|
118
|
+
/**
|
|
119
|
+
* FOV の状態を更新する
|
|
120
|
+
*/
|
|
121
|
+
private _updateFov;
|
|
122
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { PerspectiveCamera, Vector3, Ray } from 'three';
|
|
2
|
+
import { Selector, iIntersection } from './selector';
|
|
3
|
+
export interface iBoxSelectorOption {
|
|
4
|
+
width?: number;
|
|
5
|
+
segment?: number;
|
|
6
|
+
color?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 3D ガウシアンを選択するための box インターフェースを提供する
|
|
10
|
+
* @class
|
|
11
|
+
*/
|
|
12
|
+
export declare class BoxSelector extends Selector {
|
|
13
|
+
private width;
|
|
14
|
+
private geometry;
|
|
15
|
+
private material;
|
|
16
|
+
/**
|
|
17
|
+
* @param camera - TransformControls に設定するカメラ
|
|
18
|
+
* @param eventTarget - TransformControls に設定するイベント処理の対象要素
|
|
19
|
+
* @param exclusive - 排他制御を行うコントロールの配列
|
|
20
|
+
*/
|
|
21
|
+
constructor(camera: PerspectiveCamera, eventTarget: HTMLElement, option?: iBoxSelectorOption);
|
|
22
|
+
/**
|
|
23
|
+
* 設定されている一辺の長さを返す
|
|
24
|
+
*/
|
|
25
|
+
getWidth(): number;
|
|
26
|
+
/**
|
|
27
|
+
* セットアップを行う
|
|
28
|
+
* @param option - セットアップオプション
|
|
29
|
+
*/
|
|
30
|
+
setup(option?: iBoxSelectorOption): void;
|
|
31
|
+
/**
|
|
32
|
+
* 開放処理
|
|
33
|
+
*/
|
|
34
|
+
dispose(): void;
|
|
35
|
+
/**
|
|
36
|
+
* 包含判定処理
|
|
37
|
+
* @param point - 任意の点(座標)
|
|
38
|
+
*/
|
|
39
|
+
containsPoint(point: Vector3): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Ray オブジェクトの入射点と射出点までの距離を求める処理
|
|
42
|
+
* @param ray - 判定を行う Ray
|
|
43
|
+
*/
|
|
44
|
+
intersectRay(ray: Ray): iIntersection;
|
|
45
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { default as EventEmitter } from 'eventemitter3';
|
|
2
|
+
import { Euler, Matrix4, Object3D, PerspectiveCamera, Quaternion, Ray, Vector3 } from 'three';
|
|
3
|
+
import { TransformControls } from 'three/examples/jsm/controls/TransformControls';
|
|
4
|
+
/**
|
|
5
|
+
* Selector は選択範囲を管理・制御するための基底クラスで、継承される前提になっている。
|
|
6
|
+
* 対処となるカメラ、イベントをフックする DOM と、TransformControls の配列、排他処理する
|
|
7
|
+
* コントロールの配列、自身のメッシュを最低限のプロパティとして持つ。
|
|
8
|
+
* TransformControls が配列になっているのは、単体の Selector が複数の TransformControls を
|
|
9
|
+
* 同時に保持・制御するパターンが将来的にあるかもしれないため。
|
|
10
|
+
*/
|
|
11
|
+
/** セレクターに割り当てられた TransformControls に設定可能なモード */
|
|
12
|
+
export type tMode = "translate" | "rotate" | "scale";
|
|
13
|
+
/**
|
|
14
|
+
* レイとの交点を扱う
|
|
15
|
+
*/
|
|
16
|
+
export interface iIntersectionData {
|
|
17
|
+
distance: number;
|
|
18
|
+
point: Vector3;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* レイの原点が内包されるか、入射点と射出点それぞれの交点までの情報
|
|
22
|
+
*/
|
|
23
|
+
export interface iIntersection {
|
|
24
|
+
contains: boolean;
|
|
25
|
+
entry: iIntersectionData;
|
|
26
|
+
exit: iIntersectionData;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 3D ガウシアンを選択するためのインターフェースを提供する基底クラス
|
|
30
|
+
* @class
|
|
31
|
+
*/
|
|
32
|
+
export declare abstract class Selector extends EventEmitter {
|
|
33
|
+
protected camera: PerspectiveCamera;
|
|
34
|
+
protected element: HTMLElement;
|
|
35
|
+
protected controls: TransformControls[];
|
|
36
|
+
object: Object3D;
|
|
37
|
+
/**
|
|
38
|
+
* インスタンスが発火するイベント
|
|
39
|
+
*/
|
|
40
|
+
static EVENTS: string[];
|
|
41
|
+
/**
|
|
42
|
+
* セレクターの可視性
|
|
43
|
+
*/
|
|
44
|
+
set visible(visible: boolean);
|
|
45
|
+
get visible(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* @constructor
|
|
48
|
+
* @param camera - TransformControls に設定するカメラ
|
|
49
|
+
* @param eventTarget - TransformControls に設定するイベント処理の対象要素
|
|
50
|
+
* @param exclusive - 排他制御を行うコントロールの配列
|
|
51
|
+
*/
|
|
52
|
+
constructor(camera: PerspectiveCamera, eventTarget: HTMLElement);
|
|
53
|
+
/**
|
|
54
|
+
* TransformControls をセットアップする
|
|
55
|
+
* @private
|
|
56
|
+
* @param controls - 対象となるコントロール
|
|
57
|
+
*/
|
|
58
|
+
protected _setupControls(controls: TransformControls): void;
|
|
59
|
+
/**
|
|
60
|
+
* TransformControls にモードを設定する
|
|
61
|
+
* @private
|
|
62
|
+
* @param mode - 設定するモード
|
|
63
|
+
* @param index - 対象となるインデックス(省略時はすべてのコントロールを対象とする)
|
|
64
|
+
*/
|
|
65
|
+
protected _setMode(mode: tMode, index?: number): void;
|
|
66
|
+
/**
|
|
67
|
+
* すべての Object3D を配列で返す
|
|
68
|
+
*/
|
|
69
|
+
getAllObject(): Object3D[];
|
|
70
|
+
/**
|
|
71
|
+
* object のワールド変換の逆行列を返す
|
|
72
|
+
*/
|
|
73
|
+
getInverseMatrix(): Matrix4;
|
|
74
|
+
/**
|
|
75
|
+
* 現在の位置を返す
|
|
76
|
+
*/
|
|
77
|
+
getPosition(): Vector3;
|
|
78
|
+
/**
|
|
79
|
+
* 現在のスケールを返す
|
|
80
|
+
*/
|
|
81
|
+
getScale(): Vector3;
|
|
82
|
+
/**
|
|
83
|
+
* 現在の回転を返す
|
|
84
|
+
*/
|
|
85
|
+
getRotation(): Quaternion;
|
|
86
|
+
/**
|
|
87
|
+
* 現在のオイラー角返す
|
|
88
|
+
*/
|
|
89
|
+
getEuler(): Euler;
|
|
90
|
+
/**
|
|
91
|
+
* 現在の位置を設定する
|
|
92
|
+
* @param position - 設定する位置
|
|
93
|
+
*/
|
|
94
|
+
setPosition(position: Vector3): void;
|
|
95
|
+
/**
|
|
96
|
+
* 現在のスケールを設定する
|
|
97
|
+
* @param scale - 設定するスケール
|
|
98
|
+
*/
|
|
99
|
+
setScale(scale: Vector3): void;
|
|
100
|
+
/**
|
|
101
|
+
* 現在の回転を設定する
|
|
102
|
+
* @param quaternion - 設定する回転(クォータニオン)
|
|
103
|
+
*/
|
|
104
|
+
setRotation(quaternion: Quaternion): void;
|
|
105
|
+
/**
|
|
106
|
+
* 現在の回転をオイラー角で設定する
|
|
107
|
+
* @param Euler - 設定する回転(オイラー角)
|
|
108
|
+
*/
|
|
109
|
+
setEuler(euler: Euler): void;
|
|
110
|
+
/**
|
|
111
|
+
* 平行移動モードを設定する
|
|
112
|
+
* @param index - 対象となるインデックス(省略時はすべてのコントロールを対象とする)
|
|
113
|
+
*/
|
|
114
|
+
setTranslateMode(index?: number): void;
|
|
115
|
+
/**
|
|
116
|
+
* 拡大縮小モードを設定する
|
|
117
|
+
* @param index - 対象となるインデックス(省略時はすべてのコントロールを対象とする)
|
|
118
|
+
*/
|
|
119
|
+
setScaleMode(index?: number): void;
|
|
120
|
+
/**
|
|
121
|
+
* 回転モードを設定する
|
|
122
|
+
* @param index - 対象となるインデックス(省略時はすべてのコントロールを対象とする)
|
|
123
|
+
*/
|
|
124
|
+
setRotateMode(index?: number): void;
|
|
125
|
+
/**
|
|
126
|
+
* @abstract
|
|
127
|
+
* セットアップ処理は継承先で実装する
|
|
128
|
+
*/
|
|
129
|
+
abstract setup(): void;
|
|
130
|
+
/**
|
|
131
|
+
* @abstract
|
|
132
|
+
* 各種解放処理は継承先で実装する
|
|
133
|
+
*/
|
|
134
|
+
abstract dispose(): void;
|
|
135
|
+
/**
|
|
136
|
+
* @abstract
|
|
137
|
+
* 任意点の包含判定処理は継承先で実装する
|
|
138
|
+
*/
|
|
139
|
+
abstract containsPoint(point: Vector3): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* @abstract
|
|
142
|
+
* Ray オブジェクトの入射点と射出点までの距離を求める処理は継承先で実装する
|
|
143
|
+
*/
|
|
144
|
+
abstract intersectRay(ray: Ray): iIntersection;
|
|
145
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { PerspectiveCamera, Ray, Vector3 } from 'three';
|
|
2
|
+
import { Selector, iIntersection } from './selector';
|
|
3
|
+
export interface iSphereSelectorOption {
|
|
4
|
+
radius?: number;
|
|
5
|
+
segment?: number;
|
|
6
|
+
color?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 3D ガウシアンを選択するための sphere インターフェースを提供する
|
|
10
|
+
* @class
|
|
11
|
+
*/
|
|
12
|
+
export declare class SphereSelector extends Selector {
|
|
13
|
+
private radius;
|
|
14
|
+
private geometry;
|
|
15
|
+
private material;
|
|
16
|
+
/**
|
|
17
|
+
* @param camera - TransformControls に設定するカメラ
|
|
18
|
+
* @param eventTarget - TransformControls に設定するイベント処理の対象要素
|
|
19
|
+
* @param exclusive - 排他制御を行うコントロールの配列
|
|
20
|
+
*/
|
|
21
|
+
constructor(camera: PerspectiveCamera, eventTarget: HTMLElement, option?: iSphereSelectorOption);
|
|
22
|
+
/**
|
|
23
|
+
* 設定されている半径を返す
|
|
24
|
+
*/
|
|
25
|
+
getRadius(): number;
|
|
26
|
+
/**
|
|
27
|
+
* セットアップを行う
|
|
28
|
+
* @param option - セットアップオプション
|
|
29
|
+
*/
|
|
30
|
+
setup(option?: iSphereSelectorOption): void;
|
|
31
|
+
/**
|
|
32
|
+
* 開放処理
|
|
33
|
+
*/
|
|
34
|
+
dispose(): void;
|
|
35
|
+
/**
|
|
36
|
+
* 包含判定処理
|
|
37
|
+
* @param point - 任意の点(座標)
|
|
38
|
+
*/
|
|
39
|
+
containsPoint(point: Vector3): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Ray オブジェクトの入射点と射出点までの距離を求める処理
|
|
42
|
+
* @param ray - 判定を行う Ray
|
|
43
|
+
*/
|
|
44
|
+
intersectRay(ray: Ray): iIntersection;
|
|
45
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { InstancedBufferAttribute, Mesh, Box3, Sphere, DataTexture } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* 既定の InstancedMesh はインスタンスが生成される際、コンストラクタ内で this.instanceMatrix
|
|
4
|
+
* を初期化する段階で、インスタンス数分の 4x4 行列を生成する。
|
|
5
|
+
* count * 16 * 32bit のメモリを無駄に消費することになってしまうので、それを無効化するための
|
|
6
|
+
* 実装がこの InstancedMeshEX である。three.js 本体のアップグレードに追従しやすくする意図で
|
|
7
|
+
* 変更箇所は極力限定しており、該当変更箇所には = ex = のコメントが付与されている。
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* A special version of a mesh with instanced rendering support. Use
|
|
11
|
+
* this class if you have to render a large number of objects with the same
|
|
12
|
+
* geometry and material(s) but with different world transformations. The usage
|
|
13
|
+
* of 'InstancedMesh' will help you to reduce the number of draw calls and thus
|
|
14
|
+
* improve the overall rendering performance in your application.
|
|
15
|
+
*
|
|
16
|
+
* @augments Mesh
|
|
17
|
+
*/
|
|
18
|
+
declare class InstancedMeshEX extends Mesh {
|
|
19
|
+
isInstancedMesh: boolean;
|
|
20
|
+
instanceMatrix: InstancedBufferAttribute;
|
|
21
|
+
instanceColor: InstancedBufferAttribute;
|
|
22
|
+
morphTexture: DataTexture;
|
|
23
|
+
count: number;
|
|
24
|
+
boundingBox: Box3;
|
|
25
|
+
boundingSphere: Sphere;
|
|
26
|
+
/**
|
|
27
|
+
* Constructs a new instanced mesh.
|
|
28
|
+
*
|
|
29
|
+
* @param {BufferGeometry} [geometry] - The mesh geometry.
|
|
30
|
+
* @param {Material|Array<Material>} [material] - The mesh material.
|
|
31
|
+
* @param {number} count - The number of instances.
|
|
32
|
+
*/
|
|
33
|
+
constructor(geometry: any, material: any, count: any);
|
|
34
|
+
/**
|
|
35
|
+
* Computes the bounding box of the instanced mesh, and updates {@link InstancedMesh#boundingBox}.
|
|
36
|
+
* The bounding box is not automatically computed by the engine; this method must be called by your app.
|
|
37
|
+
* You may need to recompute the bounding box if an instance is transformed via {@link InstancedMesh#setMatrixAt}.
|
|
38
|
+
*/
|
|
39
|
+
computeBoundingBox(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Computes the bounding sphere of the instanced mesh, and updates {@link InstancedMesh#boundingSphere}
|
|
42
|
+
* The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling.
|
|
43
|
+
* You may need to recompute the bounding sphere if an instance is transformed via {@link InstancedMesh#setMatrixAt}.
|
|
44
|
+
*/
|
|
45
|
+
computeBoundingSphere(): void;
|
|
46
|
+
copy(source: any, recursive: any): this;
|
|
47
|
+
/**
|
|
48
|
+
* Gets the color of the defined instance.
|
|
49
|
+
*
|
|
50
|
+
* @param {number} index - The instance index.
|
|
51
|
+
* @param {Color} color - The target object that is used to store the method's result.
|
|
52
|
+
*/
|
|
53
|
+
getColorAt(index: any, color: any): void;
|
|
54
|
+
/**
|
|
55
|
+
* Gets the local transformation matrix of the defined instance.
|
|
56
|
+
*
|
|
57
|
+
* @param {number} index - The instance index.
|
|
58
|
+
* @param {Matrix4} matrix - The target object that is used to store the method's result.
|
|
59
|
+
*/
|
|
60
|
+
getMatrixAt(index: any, matrix: any): void;
|
|
61
|
+
/**
|
|
62
|
+
* Gets the morph target weights of the defined instance.
|
|
63
|
+
*
|
|
64
|
+
* @param {number} index - The instance index.
|
|
65
|
+
* @param {Mesh} object - The target object that is used to store the method's result.
|
|
66
|
+
*/
|
|
67
|
+
getMorphAt(index: any, object: any): void;
|
|
68
|
+
raycast(raycaster: any, intersects: any): void;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the given color to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
71
|
+
* {@link InstancedMesh#instanceColor} to `true` after updating all the colors.
|
|
72
|
+
*
|
|
73
|
+
* @param {number} index - The instance index.
|
|
74
|
+
* @param {Color} color - The instance color.
|
|
75
|
+
*/
|
|
76
|
+
setColorAt(index: any, color: any): void;
|
|
77
|
+
/**
|
|
78
|
+
* Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
79
|
+
* {@link InstancedMesh#instanceMatrix} to `true` after updating all the colors.
|
|
80
|
+
*
|
|
81
|
+
* @param {number} index - The instance index.
|
|
82
|
+
* @param {Matrix4} matrix - The the local transformation.
|
|
83
|
+
*/
|
|
84
|
+
setMatrixAt(index: any, matrix: any): void;
|
|
85
|
+
/**
|
|
86
|
+
* Sets the morph target weights to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
87
|
+
* {@link InstancedMesh#morphTexture} to `true` after updating all the influences.
|
|
88
|
+
*
|
|
89
|
+
* @param {number} index - The instance index.
|
|
90
|
+
* @param {Mesh} object - A mesh which `morphTargetInfluences` property containing the morph target weights
|
|
91
|
+
* of a single instance.
|
|
92
|
+
*/
|
|
93
|
+
setMorphAt(index: any, object: any): void;
|
|
94
|
+
updateMorphTargets(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
97
|
+
* method whenever this instance is no longer used in your app.
|
|
98
|
+
*/
|
|
99
|
+
dispose(): void;
|
|
100
|
+
}
|
|
101
|
+
export { InstancedMeshEX };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as EventEmitter } from 'eventemitter3';
|
|
2
|
+
/**
|
|
3
|
+
* fetch から ReadableStream を取得し逐次イベントを発火する
|
|
4
|
+
*/
|
|
5
|
+
export declare class StreamLoader extends EventEmitter {
|
|
6
|
+
/**
|
|
7
|
+
* インスタンスが発火するイベント
|
|
8
|
+
*/
|
|
9
|
+
static EVENTS: string[];
|
|
10
|
+
/**
|
|
11
|
+
* @constructor
|
|
12
|
+
*/
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* ロードを行う
|
|
16
|
+
* @param path - 読み込みの対象 URL
|
|
17
|
+
* @param option - fetch に渡されるオプション
|
|
18
|
+
*/
|
|
19
|
+
load(path: string, option?: RequestInit): Promise<void>;
|
|
20
|
+
loadFile(file: File): Promise<void>;
|
|
21
|
+
}
|
|
File without changes
|