lythreeframe 1.0.1 → 1.0.5
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/LICENSE +8 -0
- package/README.md +3 -0
- package/dist/index.ts +80 -0
- package/package.json +18 -12
- package/rollup.config.js +31 -0
- package/src/draco/README.md +32 -0
- package/src/draco/draco_decoder.js +34 -0
- package/src/draco/draco_decoder.wasm +0 -0
- package/src/draco/draco_encoder.js +33 -0
- package/src/draco/draco_wasm_wrapper.js +117 -0
- package/src/draco/gltf/draco_decoder.js +33 -0
- package/src/draco/gltf/draco_decoder.wasm +0 -0
- package/src/draco/gltf/draco_encoder.js +33 -0
- package/src/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/src/index.ts +44 -0
- package/{lythreeFrame/src → src/lythreeframe}/AssetManagement/AssetManager.ts +8 -6
- package/{lythreeFrame/src → src/lythreeframe}/AssetManagement/AssetPointer/AssetPointer.ts +1 -1
- package/{lythreeFrame/src → src/lythreeframe}/Frame/Controller.ts +7 -7
- package/{lythreeFrame/src → src/lythreeframe}/Frame/Viewport.ts +58 -58
- package/{lythreeFrame/src → src/lythreeframe}/Frame/World.ts +4 -4
- package/{lythreeFrame/src → src/lythreeframe}/Frame.ts +1 -1
- package/src/lythreeframe/Library/MaterialLibrary.ts +292 -0
- package/{lythreeFrame/src → src/lythreeframe}/Library/Math.ts +4 -4
- package/{lythreeFrame/src → src/lythreeframe}/Object/Actor.ts +2 -2
- package/{lythreeFrame/src → src/lythreeframe}/Object/Actors/Camera/CameraActor.ts +1 -1
- package/{lythreeFrame/src → src/lythreeframe}/Object/Actors/Light/DirectionalLightActor.ts +2 -2
- package/{lythreeFrame/src → src/lythreeframe}/Object/Actors/Shape/BoxActor.ts +2 -2
- package/{lythreeFrame/src → src/lythreeframe}/Object/Actors/Shape/PlaneActor.ts +2 -2
- package/src/lythreeframe/Object/Actors/Shape/TubeActor.ts +37 -0
- package/{lythreeFrame/src → src/lythreeframe}/Object/Components/2D/2DComponent.ts +1 -1
- package/{lythreeFrame/src → src/lythreeframe}/Object/Components/Camera/CameraComponent.ts +1 -1
- package/{lythreeFrame/src → src/lythreeframe}/Object/Components/Component.ts +1 -1
- package/{lythreeFrame/src → src/lythreeframe}/Object/Components/Light/LightComponent.ts +1 -1
- package/{lythreeFrame/src → src/lythreeframe}/Object/Components/Mesh/InstanceMesh/MultiInstanceMeshComponent.ts +2 -2
- package/{lythreeFrame/src → src/lythreeframe}/Object/Components/Mesh/MeshComponent.ts +2 -2
- package/{lythreeFrame/src → src/lythreeframe}/Object/Components/Mesh/Sprite/SpriteComponent.ts +1 -1
- package/{lythreeFrame/src → src/lythreeframe}/Object/Components/SceneComponent.ts +10 -8
- package/{lythreeFrame/src → src/lythreeframe}/Object/Controller/Controller.ts +2 -2
- package/{lythreeFrame/src → src/lythreeframe}/Object/Pawn/CameraStatus.ts +1 -1
- package/src/lythreeframe/Object/Pawn/FirstPerson.ts +230 -0
- package/src/lythreeframe/Object/Pawn/Oribital.ts +276 -0
- package/src/lythreeframe/Object/Pawn/PawnBase.ts +189 -0
- package/src/lythreeframe/Object/Pawn/TopView.ts +205 -0
- package/src/lythreeframe/Object/Pawn/TransformControl.ts +215 -0
- package/src/lythreeframe/Object/Pawn/staticCamera.ts +80 -0
- package/{lythreeFrame/src → src/lythreeframe}/Object/PawnV2/FirstPerson.ts +3 -3
- package/{lythreeFrame/src → src/lythreeframe}/Object/PawnV2/Oribital.ts +2 -2
- package/{lythreeFrame/src → src/lythreeframe}/Object/PawnV2/Pawn.ts +1 -1
- package/{lythreeFrame/src → src/lythreeframe}/Object/PawnV2/TransformControl.ts +6 -5
- package/{lythreeFrame/src → src/lythreeframe}/PostProcess/Param/DOF.ts +1 -2
- package/{lythreeFrame/src → src/lythreeframe}/PostProcess/PostProcessParam.ts +5 -5
- package/{lythreeFrame/src → src/lythreeframe}/ThreeJsApp.ts +4 -4
- package/tsconfig.json +105 -0
- package/lythreeFrame/index.js +0 -48
- package/lythreeFrame/src/Library/MaterialLibrary.ts +0 -288
- package/lythreeFrame/src/Object/Actors/Shape/TubeActor.ts +0 -37
- package/lythreeFrame/src/Object/Pawn/FirstPerson.ts +0 -230
- package/lythreeFrame/src/Object/Pawn/Oribital.ts +0 -276
- package/lythreeFrame/src/Object/Pawn/PawnBase.ts +0 -189
- package/lythreeFrame/src/Object/Pawn/TopView.ts +0 -205
- package/lythreeFrame/src/Object/Pawn/TransformControl.ts +0 -215
- package/lythreeFrame/src/Object/Pawn/staticCamera.ts +0 -80
- /package/{lythreeFrame/src → src/lythreeframe}/AssetManagement/AssetDefines.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/AssetManagement/Task/Task.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Container/SmartPointer.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Defines.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Delegate.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Factory/CameraFactory.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Factory/RendererFactory.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Geometry/PlaneGeometry.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Geometry/TriangleGeometry.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Library/ContainerLibrary.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Library/ResourceLibrary.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Object/Actors/Shape/CurveActor.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Object/BaseObject.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Object/Components/Light/DirectionalLight/DirectionalLightComponent.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Object/Components/Mesh/InstanceMesh/InstanceMeshComponent.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Object/Components/Mesh/Line/CurveComponent.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Object/Components/Mesh/Shape/BoxComponent.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Object/Components/Mesh/Shape/PlaneComponent.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Object/Components/Mesh/Shape/SphereComponent.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/PostProcess/Param/Bloom.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/PostProcess/Param/Denoise.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/PostProcess/Param/GTAO.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/PostProcess/Param/LensFlare.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/PostProcess/Param/MotionBlur.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/PostProcess/Param/Outline.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/PostProcess/Param/SSR.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/PostProcess/Param/ToneMapping.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/PostProcess/WebGPUPostProcessFactory.ts +0 -0
- /package/{lythreeFrame/src → src/lythreeframe}/Shader/Postprocess/ColorShader.ts +0 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// import {Euler, Quaternion, Vector3,OrthographicCamera} from "three";
|
|
2
|
+
|
|
3
|
+
// import {PawnBase} from "./PawnBase";
|
|
4
|
+
// import {LYThreeWorld} from "../../Frame";
|
|
5
|
+
// import {OrbitControls} from "three/examples/jsm/controls/OrbitControls";
|
|
6
|
+
// import {OrthographicCameraStatus} from "./CameraStatus";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// export class LYTopView extends PawnBase
|
|
10
|
+
// {
|
|
11
|
+
|
|
12
|
+
// override camera :OrthographicCamera
|
|
13
|
+
// override control:OrbitControls
|
|
14
|
+
// override cameraStatus:OrthographicCameraStatus
|
|
15
|
+
// override get Control(): any
|
|
16
|
+
// {
|
|
17
|
+
// return this.control;
|
|
18
|
+
// }
|
|
19
|
+
|
|
20
|
+
// constructor(world: LYThreeWorld)
|
|
21
|
+
// {
|
|
22
|
+
// let camera = new OrthographicCamera()
|
|
23
|
+
// camera.near = 0.1
|
|
24
|
+
// camera.far = 2000
|
|
25
|
+
|
|
26
|
+
// let control = null
|
|
27
|
+
// if(world.renderer && world.renderer.domElement)
|
|
28
|
+
// {
|
|
29
|
+
// control = new OrbitControls(camera, world.renderer.domElement)
|
|
30
|
+
// control.enableRotate = false
|
|
31
|
+
// }
|
|
32
|
+
|
|
33
|
+
// super(world, camera, control);
|
|
34
|
+
// this.camera = camera
|
|
35
|
+
// this.control = control
|
|
36
|
+
// this.control.enableRotate = false
|
|
37
|
+
// this.cameraStatus = new OrthographicCameraStatus(this.Camera, this.Camera.position.clone().add(new Vector3(0,-1000,0)))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
// }
|
|
41
|
+
|
|
42
|
+
// override get Camera(): OrthographicCamera
|
|
43
|
+
// {
|
|
44
|
+
// return this.camera
|
|
45
|
+
// }
|
|
46
|
+
|
|
47
|
+
// tick(deltaTime)
|
|
48
|
+
// {
|
|
49
|
+
// super.tick(deltaTime);
|
|
50
|
+
// }
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
// possess()
|
|
54
|
+
// {
|
|
55
|
+
|
|
56
|
+
// this.Control.addEventListener('change', this.changeEvent)
|
|
57
|
+
// this.World.markRenderStateDirty();
|
|
58
|
+
// }
|
|
59
|
+
|
|
60
|
+
// unpossess()
|
|
61
|
+
// {
|
|
62
|
+
// this.onCameraMove = null
|
|
63
|
+
// this.Control.removeEventListener("change", this.changeEvent)
|
|
64
|
+
// }
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
// setCamera(newCamera)
|
|
68
|
+
// {
|
|
69
|
+
// super.setCamera(newCamera)
|
|
70
|
+
// // this.Control.object = newCamera
|
|
71
|
+
// // this.Control.update();
|
|
72
|
+
// this.World.markRenderStateDirty();
|
|
73
|
+
// }
|
|
74
|
+
|
|
75
|
+
// setPosition(param1, param2 = undefined, param3 = undefined)
|
|
76
|
+
// {
|
|
77
|
+
// // super.setPosition(param1, param2, param3);
|
|
78
|
+
// // this.Control.update();
|
|
79
|
+
// // this.World.markRenderStateDirty();
|
|
80
|
+
// }
|
|
81
|
+
|
|
82
|
+
// setQuaternion(newQuat)
|
|
83
|
+
// {
|
|
84
|
+
// // super.setQuaternion(newQuat);
|
|
85
|
+
// // this.Control.update()
|
|
86
|
+
// // this.World.markRenderStateDirty();
|
|
87
|
+
// }
|
|
88
|
+
|
|
89
|
+
// // focusTo
|
|
90
|
+
// // @targetPos
|
|
91
|
+
// focusTo(targetPos: Vector3, targetQuat: Quaternion | Euler, distance: number, time: number = 0, onGoing: Function | null = null, onFinished: Function | null = null)
|
|
92
|
+
// {
|
|
93
|
+
// // this.Camera.position.set(targetPos.x,targetPos.y + 1000, targetPos.z);
|
|
94
|
+
// let quat1 = new Quaternion().setFromAxisAngle(new Vector3(1, 0, 0), Math.PI * 0.5).normalize();
|
|
95
|
+
|
|
96
|
+
// this.Camera.quaternion.copy(quat1)
|
|
97
|
+
// this.Control.object.position.set(targetPos.x, targetPos.y + distance, targetPos.z);
|
|
98
|
+
// this.Control.target.copy(targetPos);
|
|
99
|
+
|
|
100
|
+
// //1.计算透视相机到场景 scene 的深度距离 depth
|
|
101
|
+
// let depth = distance;
|
|
102
|
+
// let ele = this.world.OuterElement;
|
|
103
|
+
// //2.得到透视相机的宽高比和垂直可视角度
|
|
104
|
+
// let aspect = ele.clientWidth/ele.clientHeight;
|
|
105
|
+
// let fov = 60;
|
|
106
|
+
// let top_ortho = depth * Math.atan((Math.PI / 180) * (fov) / 2);
|
|
107
|
+
// let right_ortho = top_ortho * aspect;
|
|
108
|
+
// let bottom_ortho = -top_ortho;
|
|
109
|
+
// let left_ortho = -right_ortho;
|
|
110
|
+
// this.Camera.right = right_ortho
|
|
111
|
+
// this.Camera.left = left_ortho
|
|
112
|
+
// this.Camera.top = top_ortho
|
|
113
|
+
// this.Camera.bottom = bottom_ortho
|
|
114
|
+
// this.Camera.updateProjectionMatrix()
|
|
115
|
+
// this.control.update()
|
|
116
|
+
// if (onFinished)
|
|
117
|
+
// {
|
|
118
|
+
// onFinished();
|
|
119
|
+
// }
|
|
120
|
+
// this.World.markRenderStateDirty();
|
|
121
|
+
// this.cameraStatus.updateTargetPosition(targetPos)
|
|
122
|
+
// this.cameraStatus.updateCameraPosition(this.Camera.position)
|
|
123
|
+
// }
|
|
124
|
+
|
|
125
|
+
// stopFocusing()
|
|
126
|
+
// {
|
|
127
|
+
|
|
128
|
+
// }
|
|
129
|
+
|
|
130
|
+
// zoomIn()
|
|
131
|
+
// {
|
|
132
|
+
// this.Camera.zoom *= 1.1
|
|
133
|
+
// this.cameraStatus.updateCameraZoom(this.Camera.zoom)
|
|
134
|
+
// this.Camera.updateProjectionMatrix()
|
|
135
|
+
// this.World.markRenderStateDirty();
|
|
136
|
+
// }
|
|
137
|
+
|
|
138
|
+
// zoomOut()
|
|
139
|
+
// {
|
|
140
|
+
// this.Camera.zoom *= 0.9
|
|
141
|
+
// this.cameraStatus.updateCameraZoom(this.Camera.zoom)
|
|
142
|
+
// this.Camera.updateProjectionMatrix()
|
|
143
|
+
// this.World.markRenderStateDirty();
|
|
144
|
+
// }
|
|
145
|
+
|
|
146
|
+
// restore(status: OrthographicCameraStatus)
|
|
147
|
+
// {
|
|
148
|
+
// super.restore(status);
|
|
149
|
+
// this.cameraStatus.copy(status)
|
|
150
|
+
|
|
151
|
+
// this.Control.object.position.copy(status.cameraPosition.clone());
|
|
152
|
+
// this.Control.target.copy(status.targetPosition);
|
|
153
|
+
|
|
154
|
+
// let quat1 = new Quaternion().setFromAxisAngle(new Vector3(1, 0, 0), Math.PI * 0.5).normalize();
|
|
155
|
+
// this.Camera.quaternion.copy(quat1)
|
|
156
|
+
|
|
157
|
+
// //1.计算透视相机到场景 scene 的深度距离 depth
|
|
158
|
+
// let depth = this.Camera.position.clone().sub(status.targetPosition).length();
|
|
159
|
+
// let ele = this.world.OuterElement;
|
|
160
|
+
|
|
161
|
+
// //2.得到透视相机的宽高比和垂直可视角度
|
|
162
|
+
// let aspect = ele.clientWidth/ele.clientHeight;
|
|
163
|
+
// let fov = 60;
|
|
164
|
+
|
|
165
|
+
// //3.根据上述变量计算正交投影相机的视口矩形
|
|
166
|
+
// let top_ortho = depth * Math.atan((Math.PI / 180) * (fov) / 2);
|
|
167
|
+
// let right_ortho = top_ortho * aspect;
|
|
168
|
+
// let bottom_ortho = -top_ortho;
|
|
169
|
+
// let left_ortho = -right_ortho;
|
|
170
|
+
|
|
171
|
+
// this.Camera.right = right_ortho
|
|
172
|
+
// this.Camera.left = left_ortho
|
|
173
|
+
// this.Camera.top = top_ortho
|
|
174
|
+
// this.Camera.bottom = bottom_ortho
|
|
175
|
+
// this.Camera.zoom = status.zoom
|
|
176
|
+
|
|
177
|
+
// this.Camera.updateProjectionMatrix()
|
|
178
|
+
// this.Control.update()
|
|
179
|
+
|
|
180
|
+
// this.World.markRenderStateDirty();
|
|
181
|
+
|
|
182
|
+
// this.cameraStatus.updateCameraZoom(this.Camera.zoom)
|
|
183
|
+
// this.cameraStatus.updateTargetPosition(status.targetPosition)
|
|
184
|
+
// this.cameraStatus.updateCameraPosition(this.Camera.position)
|
|
185
|
+
// }
|
|
186
|
+
|
|
187
|
+
// destroy()
|
|
188
|
+
// {
|
|
189
|
+
// if (this.Control)
|
|
190
|
+
// {
|
|
191
|
+
// this.Control.dispose();
|
|
192
|
+
// }
|
|
193
|
+
// super.destroy();
|
|
194
|
+
// }
|
|
195
|
+
|
|
196
|
+
// protected onChangeEvent()
|
|
197
|
+
// {
|
|
198
|
+
// super.onChangeEvent();
|
|
199
|
+
// // this.cameraStatus.updateCameraQuaternion(this.Camera.quaternion)
|
|
200
|
+
// this.cameraStatus.update(this.Camera, this.Camera.position.clone().add(new Vector3(0,-1000,0)))
|
|
201
|
+
// this.World.markRenderStateDirty()
|
|
202
|
+
// let camPos = this.Control.object.position.clone()
|
|
203
|
+
// let targetPos = this.Control.target.clone()
|
|
204
|
+
// }
|
|
205
|
+
// }
|
|
@@ -0,0 +1,215 @@
|
|
|
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
|
+
// }
|
|
@@ -0,0 +1,80 @@
|
|
|
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 +1,12 @@
|
|
|
1
|
-
import {Pawn} from "./Pawn
|
|
1
|
+
import {Pawn} from "./Pawn";
|
|
2
2
|
import {PointerLockControls} from "three/examples/jsm/controls/PointerLockControls";
|
|
3
|
-
import {Controller} from "../../Frame/Controller
|
|
3
|
+
import {Controller} from "../../Frame/Controller";
|
|
4
4
|
|
|
5
5
|
export class FirstPerson extends Pawn
|
|
6
6
|
{
|
|
7
7
|
constructor(controller:Controller)
|
|
8
8
|
{
|
|
9
9
|
super(controller);
|
|
10
|
-
this.
|
|
10
|
+
this._control = new PointerLockControls(controller.camera, controller.viewPort.canvas)
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {Pawn} from "./Pawn
|
|
1
|
+
import {Pawn} from "./Pawn";
|
|
2
2
|
|
|
3
|
-
import {Controller} from "../../Frame/Controller
|
|
3
|
+
import {Controller} from "../../Frame/Controller";
|
|
4
4
|
import { OrbitControls } from "three/examples/jsm/Addons.js";
|
|
5
5
|
|
|
6
6
|
export class Orbital extends Pawn
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {Pawn} from "./Pawn
|
|
1
|
+
|
|
2
|
+
import {Pawn} from "./Pawn";
|
|
3
3
|
import { Matrix4, Object3D } from "three";
|
|
4
4
|
import { TransformControls } from "three/examples/jsm/controls/TransformControls.js";
|
|
5
|
+
import { Controller } from "../../Frame/Controller";
|
|
5
6
|
export interface TransformType
|
|
6
7
|
{
|
|
7
|
-
rotate:"X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
8
|
-
scale:"X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
9
|
-
translate:"X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
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;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export interface ITransforming
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { SSRParam } from './Param/SSR';
|
|
3
|
-
import {GTAOParam} from "./Param/GTAO
|
|
4
|
-
import {BloomParam} from "./Param/Bloom
|
|
5
|
-
import {ToneMappingParams} from "./Param/ToneMapping
|
|
6
|
-
import {DOFParam} from "./Param/DOF
|
|
7
|
-
import { OutlineParams } from './Param/Outline
|
|
3
|
+
import {GTAOParam} from "./Param/GTAO";
|
|
4
|
+
import {BloomParam} from "./Param/Bloom";
|
|
5
|
+
import {ToneMappingParams} from "./Param/ToneMapping";
|
|
6
|
+
import {DOFParam} from "./Param/DOF";
|
|
7
|
+
import { OutlineParams } from './Param/Outline';
|
|
8
8
|
|
|
9
9
|
export interface PostProcessParam
|
|
10
10
|
{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { DefaultPostProcessParam, PostProcessParam } from './PostProcess/PostProcessParam';
|
|
3
|
-
import {World} from "./Frame/World
|
|
4
|
-
import {Viewport} from "./Frame/Viewport
|
|
5
|
-
import {Controller} from "./Frame/Controller
|
|
3
|
+
import {World} from "./Frame/World";
|
|
4
|
+
import {Viewport} from "./Frame/Viewport";
|
|
5
|
+
import {Controller} from "./Frame/Controller";
|
|
6
6
|
import { Clock, OrthographicCamera, PerspectiveCamera} from "three";
|
|
7
|
-
import {CameraFactory, CameraParam} from "./Factory/CameraFactory
|
|
7
|
+
import {CameraFactory, CameraParam} from "./Factory/CameraFactory";
|
|
8
8
|
import { WebGPURendererParameters } from 'three/src/renderers/webgpu/WebGPURenderer.js';
|
|
9
9
|
|
|
10
10
|
export interface AppParam
|