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,262 +0,0 @@
|
|
|
1
|
-
// import {Euler, OrthographicCamera, PerspectiveCamera, Quaternion, Vector3} from "three";
|
|
2
|
-
// import {LYMath} from "../../Math/Math";
|
|
3
|
-
|
|
4
|
-
// export class CameraStatus
|
|
5
|
-
// {
|
|
6
|
-
|
|
7
|
-
// get cameraQuaternion(): Quaternion
|
|
8
|
-
// {
|
|
9
|
-
// return this._cameraQuaternion;
|
|
10
|
-
// }
|
|
11
|
-
// get targetPosition(): Vector3
|
|
12
|
-
// {
|
|
13
|
-
// return this._targetPosition;
|
|
14
|
-
// }
|
|
15
|
-
// get cameraPosition(): Vector3
|
|
16
|
-
// {
|
|
17
|
-
// return this._cameraPosition;
|
|
18
|
-
// }
|
|
19
|
-
// private _cameraPosition:Vector3
|
|
20
|
-
// private _targetPosition:Vector3
|
|
21
|
-
// private _cameraQuaternion:Quaternion
|
|
22
|
-
|
|
23
|
-
// type:string = ""
|
|
24
|
-
// constructor(camera:PerspectiveCamera|OrthographicCamera, targetPosition:Vector3)
|
|
25
|
-
// {
|
|
26
|
-
// this._cameraPosition = new Vector3()
|
|
27
|
-
// this._cameraQuaternion = new Quaternion()
|
|
28
|
-
// this._targetPosition = new Vector3()
|
|
29
|
-
// this.update(camera,targetPosition)
|
|
30
|
-
// }
|
|
31
|
-
|
|
32
|
-
// update(camera:PerspectiveCamera|OrthographicCamera, targetPosition:Vector3)
|
|
33
|
-
// {
|
|
34
|
-
// this.updateCameraPosition(camera.position)
|
|
35
|
-
// this.updateCameraQuaternion(camera.quaternion)
|
|
36
|
-
// this.updateTargetPosition(targetPosition)
|
|
37
|
-
|
|
38
|
-
// }
|
|
39
|
-
|
|
40
|
-
// updateCameraPosition(cameraPosition:Vector3)
|
|
41
|
-
// {
|
|
42
|
-
// this._cameraPosition.copy(cameraPosition)
|
|
43
|
-
// }
|
|
44
|
-
|
|
45
|
-
// updateCameraQuaternion(cameraQuaternion:Quaternion)
|
|
46
|
-
// {
|
|
47
|
-
// this._cameraQuaternion.copy(cameraQuaternion)
|
|
48
|
-
// }
|
|
49
|
-
|
|
50
|
-
// updateTargetPosition(targetPosition:Vector3)
|
|
51
|
-
// {
|
|
52
|
-
// this._targetPosition.copy(targetPosition)
|
|
53
|
-
// }
|
|
54
|
-
|
|
55
|
-
// copy(other:CameraStatus)
|
|
56
|
-
// {
|
|
57
|
-
// this.updateCameraPosition(other.cameraPosition)
|
|
58
|
-
// this.updateCameraQuaternion(other.cameraQuaternion)
|
|
59
|
-
// this.updateTargetPosition(other.targetPosition)
|
|
60
|
-
// }
|
|
61
|
-
|
|
62
|
-
// toObject():object
|
|
63
|
-
// {
|
|
64
|
-
// let euler = new Euler().setFromQuaternion(this._cameraQuaternion)
|
|
65
|
-
|
|
66
|
-
// return {
|
|
67
|
-
// position: this._cameraPosition.toArray(),
|
|
68
|
-
// euler : LYMath.threeJsEulerAngleAsDegree(euler),
|
|
69
|
-
// type : this.type
|
|
70
|
-
// }
|
|
71
|
-
// }
|
|
72
|
-
|
|
73
|
-
// fromObject(object)
|
|
74
|
-
// {
|
|
75
|
-
// this.updateCameraPosition(new Vector3().fromArray(object.position))
|
|
76
|
-
// let euler = new Euler(LYMath.degreeToRadians(object.euler.x),LYMath.degreeToRadians(object.euler.y),LYMath.degreeToRadians(object.euler.z))
|
|
77
|
-
// this.updateCameraQuaternion(new Quaternion().setFromEuler(euler))
|
|
78
|
-
// }
|
|
79
|
-
// }
|
|
80
|
-
|
|
81
|
-
// export interface ICameraStatus
|
|
82
|
-
// {
|
|
83
|
-
// restore(status:CameraStatus):void
|
|
84
|
-
// }
|
|
85
|
-
|
|
86
|
-
// export class PersepecticeCameraStatus extends CameraStatus
|
|
87
|
-
// {
|
|
88
|
-
// get fov(): number
|
|
89
|
-
// {
|
|
90
|
-
// return this._fov;
|
|
91
|
-
// }
|
|
92
|
-
// get far(): number
|
|
93
|
-
// {
|
|
94
|
-
// return this._far;
|
|
95
|
-
// }
|
|
96
|
-
// get near(): number
|
|
97
|
-
// {
|
|
98
|
-
// return this._near;
|
|
99
|
-
// }
|
|
100
|
-
|
|
101
|
-
// private _near: number = 1
|
|
102
|
-
// private _far: number = 1
|
|
103
|
-
// private _fov: number = 60
|
|
104
|
-
// constructor(camera:PerspectiveCamera, targetPosition:Vector3)
|
|
105
|
-
// {
|
|
106
|
-
// super(camera,targetPosition)
|
|
107
|
-
// this.type = "perspective"
|
|
108
|
-
// }
|
|
109
|
-
|
|
110
|
-
// update(camera:PerspectiveCamera, targetPosition:Vector3)
|
|
111
|
-
// {
|
|
112
|
-
// this.updateCameraPosition(camera.position)
|
|
113
|
-
// this.updateCameraQuaternion(camera.quaternion)
|
|
114
|
-
// this.updateTargetPosition(targetPosition)
|
|
115
|
-
|
|
116
|
-
// this.updateFar(camera.far)
|
|
117
|
-
// this.updateNear(camera.near)
|
|
118
|
-
// this.updateFOV(camera.fov)
|
|
119
|
-
// }
|
|
120
|
-
|
|
121
|
-
// updateNear(near:number)
|
|
122
|
-
// {
|
|
123
|
-
// this._near = near
|
|
124
|
-
// }
|
|
125
|
-
// updateFar(far:number)
|
|
126
|
-
// {
|
|
127
|
-
// this._far = far
|
|
128
|
-
// }
|
|
129
|
-
// updateFOV(fov:number)
|
|
130
|
-
// {
|
|
131
|
-
// this._fov = fov
|
|
132
|
-
// }
|
|
133
|
-
|
|
134
|
-
// copy(other:PersepecticeCameraStatus)
|
|
135
|
-
// {
|
|
136
|
-
// this.updateFOV(other.fov)
|
|
137
|
-
// this.updateNear(other.near)
|
|
138
|
-
// this.updateFar(other.far)
|
|
139
|
-
// super.copy(other)
|
|
140
|
-
// }
|
|
141
|
-
|
|
142
|
-
// toObject():object
|
|
143
|
-
// {
|
|
144
|
-
// let obj = super.toObject()
|
|
145
|
-
// obj.near = this._near
|
|
146
|
-
// obj.far = this._far
|
|
147
|
-
// obj.fov = this._fov
|
|
148
|
-
// return obj
|
|
149
|
-
// }
|
|
150
|
-
// fromObject(object)
|
|
151
|
-
// {
|
|
152
|
-
// super.fromObject(object)
|
|
153
|
-
// this.updateFOV(object.fov)
|
|
154
|
-
// this.updateNear(object.near)
|
|
155
|
-
// this.updateFar(object.far)
|
|
156
|
-
// }
|
|
157
|
-
// }
|
|
158
|
-
|
|
159
|
-
// export class OrthographicCameraStatus extends CameraStatus
|
|
160
|
-
// {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// constructor(camera:OrthographicCamera, targetPosition:Vector3)
|
|
164
|
-
// {
|
|
165
|
-
// super(camera,targetPosition)
|
|
166
|
-
// this.type = "orthographic"
|
|
167
|
-
|
|
168
|
-
// }
|
|
169
|
-
// get zoom(): number
|
|
170
|
-
// {
|
|
171
|
-
// return this._zoom;
|
|
172
|
-
// }
|
|
173
|
-
// private _zoom:number = 1
|
|
174
|
-
// update(camera:OrthographicCamera, targetPosition:Vector3)
|
|
175
|
-
// {
|
|
176
|
-
// this.updateCameraPosition(camera.position)
|
|
177
|
-
// this.updateCameraQuaternion(camera.quaternion)
|
|
178
|
-
// this.updateTargetPosition(targetPosition)
|
|
179
|
-
// this.updateCameraZoom(camera.zoom)
|
|
180
|
-
// this.updateCameraView(camera.left, camera.right, camera.top, camera.bottom)
|
|
181
|
-
// }
|
|
182
|
-
// updateCameraZoom(cameraZoom:number)
|
|
183
|
-
// {
|
|
184
|
-
// this._zoom = cameraZoom
|
|
185
|
-
// }
|
|
186
|
-
|
|
187
|
-
// get bottom(): number
|
|
188
|
-
// {
|
|
189
|
-
// return this._bottom;
|
|
190
|
-
// }
|
|
191
|
-
// get top(): number
|
|
192
|
-
// {
|
|
193
|
-
// return this._top;
|
|
194
|
-
// }
|
|
195
|
-
// get right(): number
|
|
196
|
-
// {
|
|
197
|
-
// return this._right;
|
|
198
|
-
// }
|
|
199
|
-
// get left(): number
|
|
200
|
-
// {
|
|
201
|
-
// return this._left;
|
|
202
|
-
// }
|
|
203
|
-
// private _left:number = -100
|
|
204
|
-
// private _right:number = -100
|
|
205
|
-
// private _top:number = -100
|
|
206
|
-
// private _bottom:number = -100
|
|
207
|
-
// updateCameraView(left:number, right:number, top:number, bottom:number)
|
|
208
|
-
// {
|
|
209
|
-
// this._left = left
|
|
210
|
-
// this._right = right
|
|
211
|
-
// this._top = top
|
|
212
|
-
// this._bottom = bottom
|
|
213
|
-
// }
|
|
214
|
-
// get far(): number
|
|
215
|
-
// {
|
|
216
|
-
// return this._far;
|
|
217
|
-
// }
|
|
218
|
-
// get near(): number
|
|
219
|
-
// {
|
|
220
|
-
// return this._near;
|
|
221
|
-
// }
|
|
222
|
-
|
|
223
|
-
// private _near: number = 1
|
|
224
|
-
// private _far: number = 1
|
|
225
|
-
// updateNear(near:number)
|
|
226
|
-
// {
|
|
227
|
-
// this._near = near
|
|
228
|
-
// }
|
|
229
|
-
// updateFar(far:number)
|
|
230
|
-
// {
|
|
231
|
-
// this._far = far
|
|
232
|
-
// }
|
|
233
|
-
|
|
234
|
-
// copy(other:OrthographicCameraStatus)
|
|
235
|
-
// {
|
|
236
|
-
// this.updateCameraView(other.left, other.right,other.top,other.bottom)
|
|
237
|
-
// this.updateNear(other.near)
|
|
238
|
-
// this.updateFar(other.far)
|
|
239
|
-
// super.copy(other)
|
|
240
|
-
// }
|
|
241
|
-
|
|
242
|
-
// toObject():object
|
|
243
|
-
// {
|
|
244
|
-
// let obj = super.toObject()
|
|
245
|
-
// obj.left = this.left
|
|
246
|
-
// obj.right = this.right
|
|
247
|
-
// obj.top = this.top
|
|
248
|
-
// obj.bottom = this.bottom
|
|
249
|
-
// obj.zoom = this.zoom
|
|
250
|
-
// obj.near = this.near
|
|
251
|
-
// obj.far = this.far
|
|
252
|
-
// return obj
|
|
253
|
-
// }
|
|
254
|
-
|
|
255
|
-
// fromObject(object)
|
|
256
|
-
// {
|
|
257
|
-
// super.fromObject(object)
|
|
258
|
-
// this.updateCameraView(object.left, object.right, object.top, object.bottom)
|
|
259
|
-
// this.updateNear(object.near)
|
|
260
|
-
// this.updateFar(object.far)
|
|
261
|
-
// }
|
|
262
|
-
// }
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
// import {PointerLockControls} from "three/examples/jsm/controls/PointerLockControls";
|
|
2
|
-
// import {
|
|
3
|
-
// CapsuleGeometry,
|
|
4
|
-
// Euler,
|
|
5
|
-
// MeshBasicMaterial,
|
|
6
|
-
// Quaternion,
|
|
7
|
-
// Vector3,
|
|
8
|
-
// Camera,
|
|
9
|
-
// Ray,
|
|
10
|
-
// Plane, PerspectiveCamera
|
|
11
|
-
// } from "three";
|
|
12
|
-
// import {CameraStatus, PawnBase} from "./PawnBase";
|
|
13
|
-
|
|
14
|
-
// export class LYFirstPerson extends PawnBase
|
|
15
|
-
// {
|
|
16
|
-
// protected speed: number = 10
|
|
17
|
-
// protected cameraHeight: number = 1.5
|
|
18
|
-
|
|
19
|
-
// protected mouseUpEvent
|
|
20
|
-
// protected keyUpEvent
|
|
21
|
-
// protected keyDownEvent
|
|
22
|
-
|
|
23
|
-
// protected isForward: boolean = false;
|
|
24
|
-
// protected isBackward: boolean = false;
|
|
25
|
-
// protected isLeft: boolean = false;
|
|
26
|
-
// protected isRight: boolean = false;
|
|
27
|
-
|
|
28
|
-
// protected domElement
|
|
29
|
-
|
|
30
|
-
// constructor(world)
|
|
31
|
-
// {
|
|
32
|
-
// let ele = world.Element;
|
|
33
|
-
// let camera = new PerspectiveCamera(60, ele.clientWidth / ele.clientHeight, 0.1, 7000)
|
|
34
|
-
// super(world,camera,new PointerLockControls(camera, world.renderer.domElement));
|
|
35
|
-
// this.domElement = world.renderer.domElement
|
|
36
|
-
|
|
37
|
-
// this.mouseUpEvent = () =>
|
|
38
|
-
// {
|
|
39
|
-
// this.Control.isLocked ? this.Control.unlock() : this.Control.lock()
|
|
40
|
-
// }
|
|
41
|
-
// this.keyDownEvent = (event) =>
|
|
42
|
-
// {
|
|
43
|
-
// this.onKeyDown(event)
|
|
44
|
-
// }
|
|
45
|
-
// this.keyUpEvent = (event) =>
|
|
46
|
-
// {
|
|
47
|
-
// this.onKeyUp(event)
|
|
48
|
-
// }
|
|
49
|
-
|
|
50
|
-
// camera.position.y = Math.max(camera.position.y + this.cameraHeight, 5)
|
|
51
|
-
|
|
52
|
-
// this.Camera.updateProjectionMatrix();
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// const geometry = new CapsuleGeometry(0.3, 1.2, 4, 8);
|
|
56
|
-
// const material = new MeshBasicMaterial({
|
|
57
|
-
// color : 0x00ff00,
|
|
58
|
-
// wireframe: true
|
|
59
|
-
// });
|
|
60
|
-
// this.cameraStatus.update(this.Camera.position, this.Camera.quaternion, 0)
|
|
61
|
-
// }
|
|
62
|
-
|
|
63
|
-
// protected onKeyDown(event)
|
|
64
|
-
// {
|
|
65
|
-
// switch (event.code)
|
|
66
|
-
// {
|
|
67
|
-
// case 'ArrowUp':
|
|
68
|
-
// case 'KeyW':
|
|
69
|
-
// this.isForward = true;
|
|
70
|
-
// break;
|
|
71
|
-
|
|
72
|
-
// case 'ArrowLeft':
|
|
73
|
-
// case 'KeyA':
|
|
74
|
-
// this.isLeft = true;
|
|
75
|
-
// break;
|
|
76
|
-
|
|
77
|
-
// case 'ArrowDown':
|
|
78
|
-
// case 'KeyS':
|
|
79
|
-
// this.isBackward = true;
|
|
80
|
-
// break;
|
|
81
|
-
|
|
82
|
-
// case 'ArrowRight':
|
|
83
|
-
// case 'KeyD':
|
|
84
|
-
// this.isRight = true;
|
|
85
|
-
// break;
|
|
86
|
-
// }
|
|
87
|
-
// }
|
|
88
|
-
|
|
89
|
-
// protected onKeyUp(event)
|
|
90
|
-
// {
|
|
91
|
-
// switch (event.code)
|
|
92
|
-
// {
|
|
93
|
-
|
|
94
|
-
// case 'ArrowUp':
|
|
95
|
-
// case 'KeyW':
|
|
96
|
-
// this.isForward = false;
|
|
97
|
-
// break;
|
|
98
|
-
|
|
99
|
-
// case 'ArrowLeft':
|
|
100
|
-
// case 'KeyA':
|
|
101
|
-
// this.isLeft = false;
|
|
102
|
-
// break;
|
|
103
|
-
|
|
104
|
-
// case 'ArrowDown':
|
|
105
|
-
// case 'KeyS':
|
|
106
|
-
// this.isBackward = false;
|
|
107
|
-
// break;
|
|
108
|
-
|
|
109
|
-
// case 'ArrowRight':
|
|
110
|
-
// case 'KeyD':
|
|
111
|
-
// this.isRight = false;
|
|
112
|
-
// break;
|
|
113
|
-
|
|
114
|
-
// }
|
|
115
|
-
// }
|
|
116
|
-
|
|
117
|
-
// tick(deltaTime)
|
|
118
|
-
// {
|
|
119
|
-
// super.tick(deltaTime)
|
|
120
|
-
|
|
121
|
-
// let movingDirection = new Vector3()
|
|
122
|
-
// movingDirection.z = this.isForward ? this.isBackward ? 0 : -1 : this.isBackward ? 1 : 0;
|
|
123
|
-
// movingDirection.x = this.isRight ? this.isLeft ? 0 : 1 : this.isLeft ? -1 : 0;
|
|
124
|
-
|
|
125
|
-
// movingDirection.applyQuaternion(this.Camera.quaternion)
|
|
126
|
-
// movingDirection.normalize()
|
|
127
|
-
// movingDirection.y = 0
|
|
128
|
-
// movingDirection.multiplyScalar(deltaTime * this.speed);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
// let finalY = this.Camera.position.y
|
|
132
|
-
// if(this.World.Octree)
|
|
133
|
-
// {
|
|
134
|
-
// let ray = new Ray(this.Camera.position, movingDirection)
|
|
135
|
-
// const result = this.World.Octree.rayIntersect(ray)
|
|
136
|
-
// if (result && (result.distance < deltaTime * this.speed))
|
|
137
|
-
// {
|
|
138
|
-
// return
|
|
139
|
-
// }
|
|
140
|
-
// let rayDown = new Ray(this.Camera.position, new Vector3(0, -1, 0))
|
|
141
|
-
// const resultDown = this.World.Octree.rayIntersect(rayDown)
|
|
142
|
-
|
|
143
|
-
// if (resultDown)
|
|
144
|
-
// {
|
|
145
|
-
// finalY = resultDown.position.y + this.cameraHeight
|
|
146
|
-
// }
|
|
147
|
-
// }
|
|
148
|
-
// this.Camera.position.set(
|
|
149
|
-
// this.Camera.position.x + movingDirection.x,
|
|
150
|
-
// finalY,
|
|
151
|
-
// this.Camera.position.z + movingDirection.z
|
|
152
|
-
// )
|
|
153
|
-
// this.cameraStatus.update(this.Camera.position, this.Camera.quaternion, 0)
|
|
154
|
-
|
|
155
|
-
// this.World.markRenderStateDirty();
|
|
156
|
-
// }
|
|
157
|
-
|
|
158
|
-
// get Camera(): Camera
|
|
159
|
-
// {
|
|
160
|
-
// return this.Control.camera;
|
|
161
|
-
// }
|
|
162
|
-
|
|
163
|
-
// setCamera(newCamera)
|
|
164
|
-
// {
|
|
165
|
-
// super.setCamera(newCamera)
|
|
166
|
-
// this.Control.camera = newCamera
|
|
167
|
-
// this.World.markRenderStateDirty();
|
|
168
|
-
// }
|
|
169
|
-
|
|
170
|
-
// possess()
|
|
171
|
-
// {
|
|
172
|
-
// this.World.Controller.IsTickable = true
|
|
173
|
-
// this.IsTickable = true;
|
|
174
|
-
// this.domElement.addEventListener('mouseup', this.mouseUpEvent)
|
|
175
|
-
// document.addEventListener('keydown', this.keyDownEvent)
|
|
176
|
-
// document.addEventListener('keyup', this.keyUpEvent)
|
|
177
|
-
// this.World.markRenderStateDirty();
|
|
178
|
-
// }
|
|
179
|
-
|
|
180
|
-
// unpossess()
|
|
181
|
-
// {
|
|
182
|
-
// this.World.Controller.IsTickable = false
|
|
183
|
-
// this.IsTickable = false
|
|
184
|
-
// this.domElement.removeEventListener('mouseup', this.mouseUpEvent)
|
|
185
|
-
// document.removeEventListener('keydown', this.keyDownEvent)
|
|
186
|
-
// document.removeEventListener('keyup', this.keyUpEvent)
|
|
187
|
-
// }
|
|
188
|
-
|
|
189
|
-
// focusTo(targetPos, targetQuat, distance, time = 0, onFinished = null)
|
|
190
|
-
// {
|
|
191
|
-
// console.log(targetPos)
|
|
192
|
-
// this.Camera.position.set(targetPos.x, targetPos.y + this.cameraHeight, targetPos.z);
|
|
193
|
-
// if (targetQuat instanceof Euler)
|
|
194
|
-
// {
|
|
195
|
-
// targetQuat = new Quaternion().setFromEuler(targetQuat)
|
|
196
|
-
// }
|
|
197
|
-
// let fV = new Vector3(0, 0, -1)
|
|
198
|
-
// fV.applyQuaternion(targetQuat)
|
|
199
|
-
// let lookingTarget = targetPos.clone()
|
|
200
|
-
// lookingTarget.add(fV.multiplyScalar(100))
|
|
201
|
-
// lookingTarget.y = targetPos.y + this.cameraHeight
|
|
202
|
-
// this.Camera.lookAt(lookingTarget.x, targetPos.y + this.cameraHeight, lookingTarget.z)
|
|
203
|
-
|
|
204
|
-
// this.cameraStatus.update(this.Camera.position, this.Camera.quaternion, lookingTarget)
|
|
205
|
-
|
|
206
|
-
// if (onFinished)
|
|
207
|
-
// {
|
|
208
|
-
// onFinished();
|
|
209
|
-
// }
|
|
210
|
-
// this.World.markRenderStateDirty();
|
|
211
|
-
// }
|
|
212
|
-
|
|
213
|
-
// restore(status: CameraStatus)
|
|
214
|
-
// {
|
|
215
|
-
// super.restore(status);
|
|
216
|
-
// this.focusTo(status.targetPosition, status.cameraQuaternion, status.targetPosition.clone().sub(status.cameraPosition).length())
|
|
217
|
-
// }
|
|
218
|
-
|
|
219
|
-
// destroy()
|
|
220
|
-
// {
|
|
221
|
-
// if (this.Control)
|
|
222
|
-
// {
|
|
223
|
-
// this.domElement.removeEventListener('mouseup', this.mouseUpEvent)
|
|
224
|
-
// document.removeEventListener('keydown', this.keyDownEvent)
|
|
225
|
-
// document.removeEventListener('keyup', this.keyUpEvent)
|
|
226
|
-
// this.Control.dispose();
|
|
227
|
-
// }
|
|
228
|
-
// super.destroy();
|
|
229
|
-
// }
|
|
230
|
-
// }
|