lythreeframe 1.0.5 → 1.0.6
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/dist/bundle.cjs.js +2646 -0
- package/dist/bundle.esm.js +2612 -0
- package/{src/index.ts → dist/index.d.ts} +40 -44
- package/dist/lythreeframe/AssetManagement/AssetDefines.d.ts +6 -0
- package/dist/lythreeframe/AssetManagement/AssetManager.d.ts +23 -0
- package/dist/lythreeframe/AssetManagement/AssetPointer/AssetPointer.d.ts +9 -0
- package/dist/lythreeframe/AssetManagement/Task/Task.d.ts +7 -0
- package/dist/lythreeframe/Container/SmartPointer.d.ts +10 -0
- package/dist/lythreeframe/Defines.d.ts +4 -0
- package/dist/lythreeframe/Delegate.d.ts +8 -0
- package/dist/lythreeframe/Factory/CameraFactory.d.ts +20 -0
- package/dist/lythreeframe/Factory/RendererFactory.d.ts +2 -0
- package/dist/lythreeframe/Frame/Controller.d.ts +40 -0
- package/dist/lythreeframe/Frame/Viewport.d.ts +50 -0
- package/dist/lythreeframe/Frame/World.d.ts +18 -0
- package/dist/lythreeframe/Geometry/PlaneGeometry.d.ts +3 -0
- package/dist/lythreeframe/Geometry/TriangleGeometry.d.ts +3 -0
- package/dist/lythreeframe/Library/ContainerLibrary.d.ts +3 -0
- package/dist/lythreeframe/Library/Math.d.ts +27 -0
- package/dist/lythreeframe/Library/ResourceLibrary.d.ts +6 -0
- package/dist/lythreeframe/Object/Actor.d.ts +86 -0
- package/dist/lythreeframe/Object/Actors/Camera/CameraActor.d.ts +4 -0
- package/dist/lythreeframe/Object/Actors/Light/DirectionalLightActor.d.ts +7 -0
- package/dist/lythreeframe/Object/Actors/Shape/BoxActor.d.ts +5 -0
- package/dist/lythreeframe/Object/Actors/Shape/PlaneActor.d.ts +9 -0
- package/dist/lythreeframe/Object/BaseObject.d.ts +10 -0
- package/dist/lythreeframe/Object/Components/2D/2DComponent.d.ts +13 -0
- package/dist/lythreeframe/Object/Components/Camera/CameraComponent.d.ts +26 -0
- package/dist/lythreeframe/Object/Components/Component.d.ts +17 -0
- package/dist/lythreeframe/Object/Components/Light/DirectionalLight/DirectionalLightComponent.d.ts +15 -0
- package/dist/lythreeframe/Object/Components/Light/LightComponent.d.ts +12 -0
- package/dist/lythreeframe/Object/Components/Mesh/InstanceMesh/InstanceMeshComponent.d.ts +7 -0
- package/dist/lythreeframe/Object/Components/Mesh/InstanceMesh/MultiInstanceMeshComponent.d.ts +13 -0
- package/dist/lythreeframe/Object/Components/Mesh/MeshComponent.d.ts +22 -0
- package/dist/lythreeframe/Object/Components/Mesh/Shape/BoxComponent.d.ts +5 -0
- package/dist/lythreeframe/Object/Components/Mesh/Shape/PlaneComponent.d.ts +5 -0
- package/dist/lythreeframe/Object/Components/Mesh/Shape/SphereComponent.d.ts +5 -0
- package/dist/lythreeframe/Object/Components/Mesh/Sprite/SpriteComponent.d.ts +8 -0
- package/dist/lythreeframe/Object/Components/SceneComponent.d.ts +66 -0
- package/dist/lythreeframe/Object/PawnV2/FirstPerson.d.ts +5 -0
- package/dist/lythreeframe/Object/PawnV2/Oribital.d.ts +12 -0
- package/dist/lythreeframe/Object/PawnV2/Pawn.d.ts +14 -0
- package/dist/lythreeframe/Object/PawnV2/TransformControl.d.ts +46 -0
- package/dist/lythreeframe/PostProcess/Param/Bloom.d.ts +6 -0
- package/dist/lythreeframe/PostProcess/Param/DOF.d.ts +6 -0
- package/dist/lythreeframe/PostProcess/Param/Denoise.d.ts +7 -0
- package/dist/lythreeframe/PostProcess/Param/GTAO.d.ts +11 -0
- package/dist/lythreeframe/PostProcess/Param/LensFlare.d.ts +6 -0
- package/dist/lythreeframe/PostProcess/Param/MotionBlur.d.ts +4 -0
- package/dist/lythreeframe/PostProcess/Param/Outline.d.ts +17 -0
- package/dist/lythreeframe/PostProcess/Param/SSR.d.ts +6 -0
- package/dist/lythreeframe/PostProcess/Param/ToneMapping.d.ts +9 -0
- package/dist/lythreeframe/PostProcess/PostProcessParam.d.ts +16 -0
- package/dist/lythreeframe/PostProcess/WebGPUPostProcessFactory.d.ts +43 -0
- package/dist/lythreeframe/Shader/Postprocess/ColorShader.d.ts +29 -0
- package/dist/lythreeframe/ThreeJsApp.d.ts +35 -0
- package/package.json +26 -14
- package/dist/index.ts +0 -80
- package/rollup.config.js +0 -31
- package/src/draco/README.md +0 -32
- package/src/draco/draco_decoder.js +0 -34
- package/src/draco/draco_decoder.wasm +0 -0
- package/src/draco/draco_encoder.js +0 -33
- package/src/draco/draco_wasm_wrapper.js +0 -117
- package/src/draco/gltf/draco_decoder.js +0 -33
- package/src/draco/gltf/draco_decoder.wasm +0 -0
- package/src/draco/gltf/draco_encoder.js +0 -33
- package/src/draco/gltf/draco_wasm_wrapper.js +0 -116
- package/src/lythreeframe/AssetManagement/AssetDefines.ts +0 -8
- package/src/lythreeframe/AssetManagement/AssetManager.ts +0 -288
- package/src/lythreeframe/AssetManagement/AssetPointer/AssetPointer.ts +0 -41
- package/src/lythreeframe/AssetManagement/Task/Task.ts +0 -24
- package/src/lythreeframe/Container/SmartPointer.ts +0 -54
- package/src/lythreeframe/Defines.ts +0 -11
- package/src/lythreeframe/Delegate.ts +0 -37
- package/src/lythreeframe/Factory/CameraFactory.ts +0 -81
- package/src/lythreeframe/Factory/RendererFactory.ts +0 -7
- package/src/lythreeframe/Frame/Controller.ts +0 -261
- package/src/lythreeframe/Frame/Viewport.ts +0 -516
- package/src/lythreeframe/Frame/World.ts +0 -59
- package/src/lythreeframe/Frame.ts +0 -511
- package/src/lythreeframe/Geometry/PlaneGeometry.ts +0 -53
- package/src/lythreeframe/Geometry/TriangleGeometry.ts +0 -50
- package/src/lythreeframe/Library/ContainerLibrary.ts +0 -21
- package/src/lythreeframe/Library/MaterialLibrary.ts +0 -292
- package/src/lythreeframe/Library/Math.ts +0 -154
- package/src/lythreeframe/Library/ResourceLibrary.ts +0 -21
- package/src/lythreeframe/Object/Actor.ts +0 -571
- package/src/lythreeframe/Object/Actors/Camera/CameraActor.ts +0 -11
- package/src/lythreeframe/Object/Actors/Light/DirectionalLightActor.ts +0 -18
- package/src/lythreeframe/Object/Actors/Shape/BoxActor.ts +0 -20
- package/src/lythreeframe/Object/Actors/Shape/CurveActor.ts +0 -11
- package/src/lythreeframe/Object/Actors/Shape/PlaneActor.ts +0 -27
- package/src/lythreeframe/Object/Actors/Shape/TubeActor.ts +0 -37
- package/src/lythreeframe/Object/BaseObject.ts +0 -45
- package/src/lythreeframe/Object/Components/2D/2DComponent.ts +0 -64
- package/src/lythreeframe/Object/Components/Camera/CameraComponent.ts +0 -113
- package/src/lythreeframe/Object/Components/Component.ts +0 -67
- package/src/lythreeframe/Object/Components/Light/DirectionalLight/DirectionalLightComponent.ts +0 -78
- package/src/lythreeframe/Object/Components/Light/LightComponent.ts +0 -54
- package/src/lythreeframe/Object/Components/Mesh/InstanceMesh/InstanceMeshComponent.ts +0 -39
- package/src/lythreeframe/Object/Components/Mesh/InstanceMesh/MultiInstanceMeshComponent.ts +0 -115
- package/src/lythreeframe/Object/Components/Mesh/Line/CurveComponent.ts +0 -221
- package/src/lythreeframe/Object/Components/Mesh/MeshComponent.ts +0 -162
- package/src/lythreeframe/Object/Components/Mesh/Shape/BoxComponent.ts +0 -17
- package/src/lythreeframe/Object/Components/Mesh/Shape/PlaneComponent.ts +0 -10
- package/src/lythreeframe/Object/Components/Mesh/Shape/SphereComponent.ts +0 -10
- package/src/lythreeframe/Object/Components/Mesh/Sprite/SpriteComponent.ts +0 -32
- package/src/lythreeframe/Object/Components/SceneComponent.ts +0 -811
- package/src/lythreeframe/Object/Controller/Controller.ts +0 -764
- package/src/lythreeframe/Object/Pawn/CameraStatus.ts +0 -262
- package/src/lythreeframe/Object/Pawn/FirstPerson.ts +0 -230
- package/src/lythreeframe/Object/Pawn/Oribital.ts +0 -276
- package/src/lythreeframe/Object/Pawn/PawnBase.ts +0 -189
- package/src/lythreeframe/Object/Pawn/TopView.ts +0 -205
- package/src/lythreeframe/Object/Pawn/TransformControl.ts +0 -215
- package/src/lythreeframe/Object/Pawn/staticCamera.ts +0 -80
- package/src/lythreeframe/Object/PawnV2/FirstPerson.ts +0 -12
- package/src/lythreeframe/Object/PawnV2/Oribital.ts +0 -45
- package/src/lythreeframe/Object/PawnV2/Pawn.ts +0 -50
- package/src/lythreeframe/Object/PawnV2/TransformControl.ts +0 -202
- package/src/lythreeframe/PostProcess/Param/Bloom.ts +0 -12
- package/src/lythreeframe/PostProcess/Param/DOF.ts +0 -13
- package/src/lythreeframe/PostProcess/Param/Denoise.ts +0 -14
- package/src/lythreeframe/PostProcess/Param/GTAO.ts +0 -21
- package/src/lythreeframe/PostProcess/Param/LensFlare.ts +0 -11
- package/src/lythreeframe/PostProcess/Param/MotionBlur.ts +0 -8
- package/src/lythreeframe/PostProcess/Param/Outline.ts +0 -20
- package/src/lythreeframe/PostProcess/Param/SSR.ts +0 -11
- package/src/lythreeframe/PostProcess/Param/ToneMapping.ts +0 -31
- package/src/lythreeframe/PostProcess/PostProcessParam.ts +0 -26
- package/src/lythreeframe/PostProcess/WebGPUPostProcessFactory.ts +0 -217
- package/src/lythreeframe/Shader/Postprocess/ColorShader.ts +0 -49
- package/src/lythreeframe/ThreeJsApp.ts +0 -124
- package/tsconfig.json +0 -105
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
// import { PawnBase } from "./PawnBase";
|
|
2
|
-
// import { LYThreeWorld } from "../../Frame";
|
|
3
|
-
// import { Camera, Matrix4, Object3D, PerspectiveCamera } from "three";
|
|
4
|
-
// import { TransformControls } from "three/examples/jsm/controls/TransformControls";
|
|
5
|
-
|
|
6
|
-
// export interface TransformType
|
|
7
|
-
// {
|
|
8
|
-
// rotate: "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
9
|
-
// scale: "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
10
|
-
// translate: "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
11
|
-
// }
|
|
12
|
-
|
|
13
|
-
// export interface ITransforming
|
|
14
|
-
// {
|
|
15
|
-
// // onTransfroming(worldPos:Vector3, worldQuat:Quaternion, worldScale:Vector3):void
|
|
16
|
-
// isTransformAllowed(): boolean;
|
|
17
|
-
|
|
18
|
-
// onTransforming(worldMatrix: Matrix4): void;
|
|
19
|
-
|
|
20
|
-
// getMatrixInWorld(): Matrix4;
|
|
21
|
-
|
|
22
|
-
// getAllowedTransformType(): TransformType;
|
|
23
|
-
// }
|
|
24
|
-
|
|
25
|
-
// export class LYTransformControl extends PawnBase
|
|
26
|
-
// {
|
|
27
|
-
// protected onChange: Function;
|
|
28
|
-
// protected onDraggingChanged: Function;
|
|
29
|
-
// protected onObjectChange: Function;
|
|
30
|
-
// protected onUpdateFunctions: Function[] = [];
|
|
31
|
-
// protected onDraggingFunctions: Function[] = [];
|
|
32
|
-
// private helperObject: Object3D = new Object3D();
|
|
33
|
-
// protected targets: ITransforming[] = [];
|
|
34
|
-
// protected primaryTarget: ITransforming | null = null;
|
|
35
|
-
// private targetMatrixMap: Map<ITransforming, Matrix4> = new Map();
|
|
36
|
-
|
|
37
|
-
// constructor(world: LYThreeWorld, camera: Camera)
|
|
38
|
-
// {
|
|
39
|
-
// camera = camera ? camera : new PerspectiveCamera();
|
|
40
|
-
// super(world, camera, new TransformControls(camera, world.renderer.domElement));
|
|
41
|
-
// world.scene?.add(this.helperObject);
|
|
42
|
-
// this.onUpdateFunctions = [];
|
|
43
|
-
// this.onChange = () =>
|
|
44
|
-
// {
|
|
45
|
-
// this.World.markRenderStateDirty();
|
|
46
|
-
// };
|
|
47
|
-
// this.onDraggingChanged = (event) =>
|
|
48
|
-
// {
|
|
49
|
-
// if (this.primaryTarget)
|
|
50
|
-
// {
|
|
51
|
-
// let tMatrix = this.primaryTarget.getMatrixInWorld();
|
|
52
|
-
// tMatrix.decompose(this.helperObject.position, this.helperObject.quaternion, this.helperObject.scale);
|
|
53
|
-
// }
|
|
54
|
-
// this.onDraggingFunctions.forEach((elem) =>
|
|
55
|
-
// {
|
|
56
|
-
// elem(event.value);
|
|
57
|
-
// });
|
|
58
|
-
// };
|
|
59
|
-
// this.onObjectChange = () =>
|
|
60
|
-
// {
|
|
61
|
-
// if (this.primaryTarget)
|
|
62
|
-
// {
|
|
63
|
-
// const TA1 = this.primaryTarget.getMatrixInWorld();
|
|
64
|
-
// this.helperObject.updateMatrixWorld(true);
|
|
65
|
-
// const TA2 = this.helperObject.matrixWorld.clone();
|
|
66
|
-
// // 将初始矩阵分解为位置、旋转和缩放
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
// this.primaryTarget.onTransforming(TA2);
|
|
70
|
-
|
|
71
|
-
// const TA1Inverse = TA1.clone().invert();
|
|
72
|
-
// const transformMatrix = new Matrix4().multiplyMatrices(TA2, TA1Inverse);
|
|
73
|
-
// this.targets.forEach((tar) =>
|
|
74
|
-
// {
|
|
75
|
-
|
|
76
|
-
// //
|
|
77
|
-
// // let TB1 = tar.getMatrixInWorld(); // B 的初始世界矩阵
|
|
78
|
-
// // let TB2 = new Matrix4().multiplyMatrices(transformMatrix, TB1); // B
|
|
79
|
-
// //
|
|
80
|
-
// // tar.onTransforming(TB2)
|
|
81
|
-
// // let TB1 = tar.getMatrixInWorld();
|
|
82
|
-
// // const TB_local = TB1.clone().invert().multiply(TA1);
|
|
83
|
-
|
|
84
|
-
// if (tar !== this.primaryTarget)
|
|
85
|
-
// {
|
|
86
|
-
// let TB2 = new Matrix4().multiplyMatrices(TA2, this.targetMatrixMap.get(tar)); // B
|
|
87
|
-
|
|
88
|
-
// tar.onTransforming(TB2);
|
|
89
|
-
// }
|
|
90
|
-
|
|
91
|
-
// });
|
|
92
|
-
|
|
93
|
-
// // this.primaryTarget.onTransforming(this.helperObject.matrix)
|
|
94
|
-
|
|
95
|
-
// }
|
|
96
|
-
// this.onUpdateFunctions.forEach((elem) =>
|
|
97
|
-
// {
|
|
98
|
-
// elem();
|
|
99
|
-
// });
|
|
100
|
-
// };
|
|
101
|
-
// this.setSize(0.5);
|
|
102
|
-
// this.World.markRenderStateDirty();
|
|
103
|
-
|
|
104
|
-
// }
|
|
105
|
-
|
|
106
|
-
// tick(deltaTime)
|
|
107
|
-
// {
|
|
108
|
-
// super.tick(deltaTime);
|
|
109
|
-
// }
|
|
110
|
-
|
|
111
|
-
// get Camera()
|
|
112
|
-
// {
|
|
113
|
-
// return this.Control.camera;
|
|
114
|
-
// }
|
|
115
|
-
|
|
116
|
-
// set enable(newEnable)
|
|
117
|
-
// {
|
|
118
|
-
// this.Control.enabled = newEnable;
|
|
119
|
-
// }
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
// setTarget(primaryTarget: ITransforming, multiTargets: ITransforming[], onUpdate: Function | null = null, onDragging: Function | null)
|
|
123
|
-
// {
|
|
124
|
-
// this.targetMatrixMap.clear();
|
|
125
|
-
// let tMatrix = primaryTarget.getMatrixInWorld();
|
|
126
|
-
// tMatrix.decompose(this.helperObject.position, this.helperObject.quaternion, this.helperObject.scale);
|
|
127
|
-
// this.Control.attach(this.helperObject);
|
|
128
|
-
// this.primaryTarget = primaryTarget;
|
|
129
|
-
// this.targets = multiTargets;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// this.targets.forEach((elem) =>
|
|
133
|
-
// {
|
|
134
|
-
// const tarMatrix = elem.getMatrixInWorld();
|
|
135
|
-
// const TB_local = tMatrix.clone().invert().multiply(tarMatrix);
|
|
136
|
-
|
|
137
|
-
// this.targetMatrixMap.set(elem, TB_local);
|
|
138
|
-
// });
|
|
139
|
-
|
|
140
|
-
// if (onUpdate)
|
|
141
|
-
// {
|
|
142
|
-
// this.onUpdateFunctions.push(onUpdate);
|
|
143
|
-
// }
|
|
144
|
-
|
|
145
|
-
// if (onUpdate)
|
|
146
|
-
// {
|
|
147
|
-
// this.onUpdateFunctions.push(onUpdate);
|
|
148
|
-
// }
|
|
149
|
-
// if (onDragging)
|
|
150
|
-
// {
|
|
151
|
-
// this.onDraggingFunctions.push(onDragging);
|
|
152
|
-
// }
|
|
153
|
-
// this.IsTickable = true;
|
|
154
|
-
// }
|
|
155
|
-
|
|
156
|
-
// getMode(): "translate" | "rotate" | "scale"
|
|
157
|
-
// {
|
|
158
|
-
// return this.Control.getMode();
|
|
159
|
-
// }
|
|
160
|
-
|
|
161
|
-
// setMode(mode: "translate" | "rotate" | "scale"): void
|
|
162
|
-
// {
|
|
163
|
-
// this.Control.setMode(mode);
|
|
164
|
-
// }
|
|
165
|
-
|
|
166
|
-
// setSpace(space: "world" | "local"): void
|
|
167
|
-
// {
|
|
168
|
-
// this.Control.setSpace(space);
|
|
169
|
-
// }
|
|
170
|
-
|
|
171
|
-
// setAxis(axis: "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null)
|
|
172
|
-
// {
|
|
173
|
-
// this.Control.showX = axis?.indexOf("X") >= 0;
|
|
174
|
-
// this.Control.showY = axis?.indexOf("Y") >= 0;
|
|
175
|
-
// this.Control.showZ = axis?.indexOf("Z") >= 0;
|
|
176
|
-
// }
|
|
177
|
-
|
|
178
|
-
// setSize(size: number): void
|
|
179
|
-
// {
|
|
180
|
-
// this.Control.setSize(size);
|
|
181
|
-
// }
|
|
182
|
-
|
|
183
|
-
// setCamera(newCamera)
|
|
184
|
-
// {
|
|
185
|
-
// super.setCamera(newCamera);
|
|
186
|
-
// this.Control.camera = newCamera;
|
|
187
|
-
// this.World.markRenderStateDirty();
|
|
188
|
-
// }
|
|
189
|
-
|
|
190
|
-
// possess()
|
|
191
|
-
// {
|
|
192
|
-
// this.World.scene.add(this.Control.getHelper());
|
|
193
|
-
// this.Control.addEventListener('change', this.onChange);
|
|
194
|
-
// this.Control.addEventListener('dragging-changed', this.onDraggingChanged);
|
|
195
|
-
// this.Control.addEventListener('objectChange', this.onObjectChange);
|
|
196
|
-
// }
|
|
197
|
-
|
|
198
|
-
// unpossess()
|
|
199
|
-
// {
|
|
200
|
-
// this.World.scene.remove(this.Control.getHelper());
|
|
201
|
-
// this.onUpdateFunctions = [];
|
|
202
|
-
// this.Control.removeEventListener('change', this.onChange);
|
|
203
|
-
// this.Control.removeEventListener('dragging-changed', this.onDraggingChanged);
|
|
204
|
-
// this.Control.removeEventListener('objectChange', this.onObjectChange);
|
|
205
|
-
// }
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
// destroy()
|
|
209
|
-
// {
|
|
210
|
-
// this.IsTickable = false;
|
|
211
|
-
// this.world.scene?.remove(this.helperObject);
|
|
212
|
-
|
|
213
|
-
// super.destroy();
|
|
214
|
-
// }
|
|
215
|
-
// }
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// import { PointerLockControls } from 'three/addons/controls/PointerLockControls.js';
|
|
2
|
-
// import {Euler, PerspectiveCamera, Quaternion} from "three";
|
|
3
|
-
// import {CameraStatus, PawnBase} from "./PawnBase";
|
|
4
|
-
|
|
5
|
-
// export class LYStaticCamera extends PawnBase
|
|
6
|
-
// {
|
|
7
|
-
// protected speed: number = 3
|
|
8
|
-
// protected cameraHeight: number = 15
|
|
9
|
-
// protected domElement
|
|
10
|
-
|
|
11
|
-
// constructor(world)
|
|
12
|
-
// {
|
|
13
|
-
// let ele = world.Element;
|
|
14
|
-
// let camera = new PerspectiveCamera(90, ele.clientWidth / ele.clientHeight, 0.5, 7000)
|
|
15
|
-
// super(world, camera, new PointerLockControls(camera, world.renderer.domElement));
|
|
16
|
-
// this.domElement = world.renderer.domElement
|
|
17
|
-
|
|
18
|
-
// camera.position.y = Math.max(camera.position.y, 5)
|
|
19
|
-
|
|
20
|
-
// this.World.markRenderStateDirty();
|
|
21
|
-
// }
|
|
22
|
-
|
|
23
|
-
// tick(deltaTime)
|
|
24
|
-
// {
|
|
25
|
-
// super.tick(deltaTime)
|
|
26
|
-
// }
|
|
27
|
-
|
|
28
|
-
// get Camera()
|
|
29
|
-
// {
|
|
30
|
-
// return this.Control.camera;
|
|
31
|
-
// }
|
|
32
|
-
|
|
33
|
-
// setCamera(newCamera)
|
|
34
|
-
// {
|
|
35
|
-
// super.setCamera(newCamera)
|
|
36
|
-
// this.Control.camera = newCamera
|
|
37
|
-
// this.World.markRenderStateDirty();
|
|
38
|
-
// }
|
|
39
|
-
|
|
40
|
-
// possess()
|
|
41
|
-
// {
|
|
42
|
-
// }
|
|
43
|
-
|
|
44
|
-
// unpossess()
|
|
45
|
-
// {
|
|
46
|
-
|
|
47
|
-
// }
|
|
48
|
-
|
|
49
|
-
// focusTo(targetPos, targetQuat, distance, time = 0, onFinished = null)
|
|
50
|
-
// {
|
|
51
|
-
// this.Camera.position.set(targetPos.x, targetPos.y + this.cameraHeight, targetPos.z);
|
|
52
|
-
// if (targetQuat instanceof Euler)
|
|
53
|
-
// {
|
|
54
|
-
// targetQuat = new Quaternion().setFromEuler(targetQuat)
|
|
55
|
-
// }
|
|
56
|
-
// this.Camera.quaternion.set(targetQuat.x, targetQuat.y, targetQuat.z, targetQuat.w)
|
|
57
|
-
// this.cameraStatus.update(this.Camera.position, this.Camera.quaternion, targetPos)
|
|
58
|
-
|
|
59
|
-
// if (onFinished)
|
|
60
|
-
// {
|
|
61
|
-
// onFinished();
|
|
62
|
-
// }
|
|
63
|
-
// this.World.markRenderStateDirty();
|
|
64
|
-
// }
|
|
65
|
-
|
|
66
|
-
// restore(status: CameraStatus)
|
|
67
|
-
// {
|
|
68
|
-
// super.restore(status);
|
|
69
|
-
// this.focusTo(status.targetPosition, status.cameraQuaternion, status.targetPosition.clone().sub(status.cameraPosition).length())
|
|
70
|
-
// }
|
|
71
|
-
|
|
72
|
-
// destroy()
|
|
73
|
-
// {
|
|
74
|
-
// if (this.Control)
|
|
75
|
-
// {
|
|
76
|
-
// this.Control.dispose();
|
|
77
|
-
// }
|
|
78
|
-
// super.destroy();
|
|
79
|
-
// }
|
|
80
|
-
// }
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {Pawn} from "./Pawn";
|
|
2
|
-
import {PointerLockControls} from "three/examples/jsm/controls/PointerLockControls";
|
|
3
|
-
import {Controller} from "../../Frame/Controller";
|
|
4
|
-
|
|
5
|
-
export class FirstPerson extends Pawn
|
|
6
|
-
{
|
|
7
|
-
constructor(controller:Controller)
|
|
8
|
-
{
|
|
9
|
-
super(controller);
|
|
10
|
-
this._control = new PointerLockControls(controller.camera, controller.viewPort.canvas)
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {Pawn} from "./Pawn";
|
|
2
|
-
|
|
3
|
-
import {Controller} from "../../Frame/Controller";
|
|
4
|
-
import { OrbitControls } from "three/examples/jsm/Addons.js";
|
|
5
|
-
|
|
6
|
-
export class Orbital extends Pawn
|
|
7
|
-
{
|
|
8
|
-
override get control():OrbitControls
|
|
9
|
-
{
|
|
10
|
-
if(!this._control)
|
|
11
|
-
{
|
|
12
|
-
throw new Error("Control not initialized")
|
|
13
|
-
}
|
|
14
|
-
return this._control;
|
|
15
|
-
}
|
|
16
|
-
protected override _control:OrbitControls
|
|
17
|
-
protected changeEvent = ()=>{this.onChange()}
|
|
18
|
-
|
|
19
|
-
constructor(controller:Controller)
|
|
20
|
-
{
|
|
21
|
-
super(controller);
|
|
22
|
-
this._control = new OrbitControls(controller.camera, controller.viewPort.canvas)
|
|
23
|
-
this.control.target.set( 0, 0, 0 );
|
|
24
|
-
controller.camera.position.set( 0, 4, 4 );
|
|
25
|
-
this.control.update()
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
possess()
|
|
29
|
-
{
|
|
30
|
-
super.possess()
|
|
31
|
-
this.control.addEventListener('change', this.changeEvent)
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
unpossess()
|
|
36
|
-
{
|
|
37
|
-
super.unpossess()
|
|
38
|
-
this.control.removeEventListener("change", this.changeEvent)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
onChange()
|
|
42
|
-
{
|
|
43
|
-
this.controller.viewPort.markRenderStateDirty();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {Controller} from "../../Frame/Controller";
|
|
3
|
-
|
|
4
|
-
export abstract class Pawn
|
|
5
|
-
{
|
|
6
|
-
get camera()
|
|
7
|
-
{
|
|
8
|
-
return this.controller.camera
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
set enabled(value:boolean)
|
|
12
|
-
{
|
|
13
|
-
this.control.enabled = value
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get control():any
|
|
17
|
-
{
|
|
18
|
-
if(!this._control)
|
|
19
|
-
{
|
|
20
|
-
throw new Error("Control not initialized")
|
|
21
|
-
}
|
|
22
|
-
return this._control;
|
|
23
|
-
}
|
|
24
|
-
protected _control : any|null = null;
|
|
25
|
-
protected controller : Controller;
|
|
26
|
-
protected isTickEnabled: boolean = false;
|
|
27
|
-
|
|
28
|
-
protected constructor(controller:Controller)
|
|
29
|
-
{
|
|
30
|
-
this.controller = controller;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
tick(deltaTime:number)
|
|
34
|
-
{
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
possess()
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
unpossess()
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
destroy()
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {Pawn} from "./Pawn";
|
|
3
|
-
import { Matrix4, Object3D } from "three";
|
|
4
|
-
import { TransformControls } from "three/examples/jsm/controls/TransformControls.js";
|
|
5
|
-
import { Controller } from "../../Frame/Controller";
|
|
6
|
-
export interface TransformType
|
|
7
|
-
{
|
|
8
|
-
rotate : "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
9
|
-
scale : "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
10
|
-
translate: "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ITransforming
|
|
14
|
-
{
|
|
15
|
-
// onTransfroming(worldPos:Vector3, worldQuat:Quaternion, worldScale:Vector3):void
|
|
16
|
-
isTransformAllowed():boolean;
|
|
17
|
-
onTransforming(worldMatrix:Matrix4):void;
|
|
18
|
-
getMatrixInWorld():Matrix4;
|
|
19
|
-
getAllowedTransformType(): TransformType;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export class TransformGizmo extends Pawn
|
|
23
|
-
{
|
|
24
|
-
override get control():TransformControls
|
|
25
|
-
{
|
|
26
|
-
if(!this._control)
|
|
27
|
-
{
|
|
28
|
-
throw new Error("Control not initialized")
|
|
29
|
-
}
|
|
30
|
-
return this._control;
|
|
31
|
-
}
|
|
32
|
-
protected override _control : TransformControls|null = null
|
|
33
|
-
private helperObject : Object3D = new Object3D();
|
|
34
|
-
private targets : ITransforming[] = [];
|
|
35
|
-
private primaryTarget : ITransforming | null = null;
|
|
36
|
-
private targetMatrixMap: Map<ITransforming, Matrix4> = new Map();
|
|
37
|
-
|
|
38
|
-
protected onDraggingChangedEvent:(param:{ value: unknown })=>void = (param:{ value: unknown })=>{this.onDraggingChanged(param)}
|
|
39
|
-
protected onObjectChangeEvent:()=>void = ()=>{this.onObjectChanged()}
|
|
40
|
-
protected onChangeEvent:()=>void = ()=>{this.onChange()};
|
|
41
|
-
|
|
42
|
-
protected onUpdateFunctions:(()=>void)[] = [];
|
|
43
|
-
protected onDraggingFunctions:((event:any)=>void)[] = [];
|
|
44
|
-
|
|
45
|
-
constructor(controller:Controller)
|
|
46
|
-
{
|
|
47
|
-
super(controller);
|
|
48
|
-
this._control = new TransformControls(controller.camera, controller.viewPort.canvas)
|
|
49
|
-
this.control.getHelper().traverse((elem)=>{
|
|
50
|
-
elem.userData["rayIgnored"] = true
|
|
51
|
-
})
|
|
52
|
-
this.helperObject.name = "TransformHelperObject"
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
possess()
|
|
56
|
-
{
|
|
57
|
-
this.controller.world.scene?.add(this.helperObject);
|
|
58
|
-
this.control.attach(this.helperObject);
|
|
59
|
-
this.control.addEventListener('change', this.onChangeEvent);
|
|
60
|
-
this.control.addEventListener('dragging-changed', this.onDraggingChangedEvent);
|
|
61
|
-
this.control.addEventListener('objectChange', this.onObjectChangeEvent);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
unpossess()
|
|
65
|
-
{
|
|
66
|
-
this.control.removeEventListener('change', this.onChangeEvent);
|
|
67
|
-
this.control.removeEventListener('dragging-changed', this.onDraggingChangedEvent);
|
|
68
|
-
this.control.removeEventListener('objectChange', this.onObjectChangeEvent);
|
|
69
|
-
this.control.detach();
|
|
70
|
-
this.controller.world.scene?.remove(this.helperObject);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
onChange()
|
|
74
|
-
{
|
|
75
|
-
this.controller.viewPort.markRenderStateDirty();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
onDraggingChanged(event:{value:any})
|
|
79
|
-
{
|
|
80
|
-
if (this.primaryTarget)
|
|
81
|
-
{
|
|
82
|
-
let tMatrix = this.primaryTarget.getMatrixInWorld();
|
|
83
|
-
tMatrix.decompose(this.helperObject.position, this.helperObject.quaternion, this.helperObject.scale);
|
|
84
|
-
}
|
|
85
|
-
this.onDraggingFunctions.forEach((elem) =>
|
|
86
|
-
{
|
|
87
|
-
elem(event.value);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
onObjectChanged()
|
|
92
|
-
{
|
|
93
|
-
if (this.primaryTarget)
|
|
94
|
-
{
|
|
95
|
-
//const TA1 = this.primaryTarget.getMatrixInWorld();
|
|
96
|
-
this.helperObject.updateMatrixWorld(true);
|
|
97
|
-
const TA2 = this.helperObject.matrixWorld.clone();
|
|
98
|
-
|
|
99
|
-
this.primaryTarget.onTransforming(TA2);
|
|
100
|
-
|
|
101
|
-
// const TA1Inverse = TA1.clone().invert();
|
|
102
|
-
//const transformMatrix = new Matrix4().multiplyMatrices(TA2, TA1Inverse);
|
|
103
|
-
this.targets.forEach((tar) =>
|
|
104
|
-
{
|
|
105
|
-
if (tar !== this.primaryTarget)
|
|
106
|
-
{
|
|
107
|
-
let t = this.targetMatrixMap.get(tar)
|
|
108
|
-
if(t)
|
|
109
|
-
{
|
|
110
|
-
let TB2 = new Matrix4().multiplyMatrices(TA2, t); // B
|
|
111
|
-
|
|
112
|
-
tar.onTransforming(TB2);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
this.onUpdateFunctions.forEach((elem) =>
|
|
119
|
-
{
|
|
120
|
-
elem();
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
set enable(newEnable:boolean)
|
|
125
|
-
{
|
|
126
|
-
this.control.enabled = newEnable;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
setTarget(primaryTarget:ITransforming, multiTargets:ITransforming[], onUpdate:(()=>void) | null = null, onDragging:((bDragging:boolean)=>void) | null = null)
|
|
131
|
-
{
|
|
132
|
-
this.targetMatrixMap.clear();
|
|
133
|
-
let tMatrix = primaryTarget.getMatrixInWorld();
|
|
134
|
-
tMatrix.decompose(this.helperObject.position, this.helperObject.quaternion, this.helperObject.scale);
|
|
135
|
-
this.controller.world.scene?.add(this.control.getHelper());
|
|
136
|
-
// this.control.attach(this.helperObject);
|
|
137
|
-
this.primaryTarget = primaryTarget;
|
|
138
|
-
this.targets = multiTargets;
|
|
139
|
-
this.targets.forEach((elem) =>
|
|
140
|
-
{
|
|
141
|
-
const tarMatrix = elem.getMatrixInWorld();
|
|
142
|
-
const TB_local = tMatrix.clone().invert().multiply(tarMatrix);
|
|
143
|
-
this.targetMatrixMap.set(elem, TB_local);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
if (onUpdate)
|
|
147
|
-
{
|
|
148
|
-
this.onUpdateFunctions.push(onUpdate);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (onUpdate)
|
|
152
|
-
{
|
|
153
|
-
this.onUpdateFunctions.push(onUpdate);
|
|
154
|
-
}
|
|
155
|
-
if (onDragging)
|
|
156
|
-
{
|
|
157
|
-
this.onDraggingFunctions.push(onDragging);
|
|
158
|
-
}
|
|
159
|
-
this.isTickEnabled = true;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
getMode():"translate" | "rotate" | "scale"
|
|
163
|
-
{
|
|
164
|
-
return this.control.getMode();
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
setMode(mode:"translate" | "rotate" | "scale"):void
|
|
168
|
-
{
|
|
169
|
-
this.control.setMode(mode);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
setSpace(space:"world" | "local"):void
|
|
173
|
-
{
|
|
174
|
-
this.control.setSpace(space);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
setAxis(axis:"X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null)
|
|
178
|
-
{
|
|
179
|
-
this.control.showX = axis ? axis?.includes("X") : false;
|
|
180
|
-
this.control.showY = axis ? axis?.includes("Y") : false;
|
|
181
|
-
this.control.showZ = axis ? axis?.includes("Z") : false;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
setSize(size:number):void
|
|
185
|
-
{
|
|
186
|
-
this.control.setSize(size);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
destroy()
|
|
190
|
-
{
|
|
191
|
-
this.isTickEnabled = false;
|
|
192
|
-
this.unpossess();
|
|
193
|
-
this.targetMatrixMap.clear();
|
|
194
|
-
this.targets = [];
|
|
195
|
-
this.primaryTarget = null;
|
|
196
|
-
this.onUpdateFunctions = [];
|
|
197
|
-
this.onDraggingFunctions = [];
|
|
198
|
-
this._control?.dispose();
|
|
199
|
-
this._control = null;
|
|
200
|
-
super.destroy();
|
|
201
|
-
}
|
|
202
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { DefaultDenoiseParam, DenoiseParam } from './Denoise';
|
|
2
|
-
export interface GTAOParam
|
|
3
|
-
{
|
|
4
|
-
distanceExponent: number,
|
|
5
|
-
distanceFallOff : number,
|
|
6
|
-
radius : number,
|
|
7
|
-
scale : number,
|
|
8
|
-
thickness : number,
|
|
9
|
-
denoised : boolean,
|
|
10
|
-
denoiseParam : DenoiseParam,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const DefaultGTAOParam:GTAOParam = {
|
|
14
|
-
distanceExponent:1,
|
|
15
|
-
distanceFallOff :1,
|
|
16
|
-
radius :0.25,
|
|
17
|
-
scale :1,
|
|
18
|
-
thickness :1,
|
|
19
|
-
denoised :true,
|
|
20
|
-
denoiseParam :DefaultDenoiseParam,
|
|
21
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface LensFlareParam {
|
|
2
|
-
threshold : number ;
|
|
3
|
-
ghostSpacing : number ;
|
|
4
|
-
ghostAttenuationFactor: number ;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const DefaultLensFlareParam: LensFlareParam = {
|
|
8
|
-
threshold : 0.5,
|
|
9
|
-
ghostSpacing : 25,
|
|
10
|
-
ghostAttenuationFactor: 0.25,
|
|
11
|
-
};
|