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,276 +0,0 @@
|
|
|
1
|
-
// import {Euler, Quaternion, Vector3,Vector2, PerspectiveCamera} from "three";
|
|
2
|
-
// import {gsap} from 'gsap';
|
|
3
|
-
|
|
4
|
-
// import {CameraStatus, PawnBase} from "./PawnBase";
|
|
5
|
-
// import {LYThreeWorld} from "../../Frame";
|
|
6
|
-
// import {OrbitControls} from "three/examples/jsm/controls/OrbitControls";
|
|
7
|
-
// import {PersepecticeCameraStatus} from "./CameraStatus";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// export class LYOrbital extends PawnBase
|
|
11
|
-
// {
|
|
12
|
-
// protected anim
|
|
13
|
-
// private minAzimuthAngle: number;
|
|
14
|
-
// private maxAzimuthAngle: number;
|
|
15
|
-
// private minPolarAngle: number;
|
|
16
|
-
// private maxPolarAngle: number;
|
|
17
|
-
// override cameraStatus:PersepecticeCameraStatus
|
|
18
|
-
// constructor(world: LYThreeWorld)
|
|
19
|
-
// {
|
|
20
|
-
// let ele = world.Element;
|
|
21
|
-
// let camera = new PerspectiveCamera(60, ele.clientWidth / ele.clientHeight, 0.5, 7000)
|
|
22
|
-
// super(world, camera, new OrbitControls(camera, world.renderer.domElement));
|
|
23
|
-
|
|
24
|
-
// this.Camera.updateProjectionMatrix();
|
|
25
|
-
// // this.enabled = false;
|
|
26
|
-
// //this.Control.maxDistance = 300;
|
|
27
|
-
// this.Control.maxPolarAngle = 0.49 * Math.PI;
|
|
28
|
-
// this.minAzimuthAngle = this.Control.minAzimuthAngle
|
|
29
|
-
// this.maxAzimuthAngle = this.Control.maxAzimuthAngle
|
|
30
|
-
// this.minPolarAngle = this.Control.minPolarAngle
|
|
31
|
-
// this.maxPolarAngle = this.Control.maxPolarAngle
|
|
32
|
-
// this.IsTickable = true
|
|
33
|
-
|
|
34
|
-
// this.cameraStatus = new PersepecticeCameraStatus(this.Camera, this.Camera.position)
|
|
35
|
-
// }
|
|
36
|
-
|
|
37
|
-
// tick(deltaTime:number)
|
|
38
|
-
// {
|
|
39
|
-
// super.tick(deltaTime);
|
|
40
|
-
|
|
41
|
-
// }
|
|
42
|
-
|
|
43
|
-
// set enabled(newEnable: boolean)
|
|
44
|
-
// {
|
|
45
|
-
// this.Control.panSpeed = newEnable ? 1 : 0;
|
|
46
|
-
// this.Control.rotateSpeed = newEnable ? 1 : 0;
|
|
47
|
-
// this.Control.zoomSpeed = newEnable ? 1 : 0;
|
|
48
|
-
// }
|
|
49
|
-
|
|
50
|
-
// possess()
|
|
51
|
-
// {
|
|
52
|
-
// super.possess()
|
|
53
|
-
// this.Control.addEventListener('change', this.changeEvent)
|
|
54
|
-
// this.World.markRenderStateDirty();
|
|
55
|
-
// }
|
|
56
|
-
|
|
57
|
-
// unpossess()
|
|
58
|
-
// {
|
|
59
|
-
// super.unpossess()
|
|
60
|
-
// this.Control.removeEventListener("change", this.changeEvent)
|
|
61
|
-
// this.onCameraMove = null
|
|
62
|
-
// if (this.anim)
|
|
63
|
-
// {
|
|
64
|
-
// this.anim.kill();
|
|
65
|
-
// }
|
|
66
|
-
// }
|
|
67
|
-
|
|
68
|
-
// get Camera()
|
|
69
|
-
// {
|
|
70
|
-
// return this.Control.object
|
|
71
|
-
// }
|
|
72
|
-
|
|
73
|
-
// setCamera(newCamera)
|
|
74
|
-
// {
|
|
75
|
-
// super.setCamera(newCamera)
|
|
76
|
-
// this.Control.object = newCamera
|
|
77
|
-
// this.Control.update();
|
|
78
|
-
// this.World.markRenderStateDirty();
|
|
79
|
-
// }
|
|
80
|
-
|
|
81
|
-
// setPosition(param1, param2 = undefined, param3 = undefined)
|
|
82
|
-
// {
|
|
83
|
-
// super.setPosition(param1, param2, param3);
|
|
84
|
-
// this.Control.update();
|
|
85
|
-
// this.World.markRenderStateDirty();
|
|
86
|
-
// }
|
|
87
|
-
|
|
88
|
-
// setQuaternion(newQuat)
|
|
89
|
-
// {
|
|
90
|
-
// super.setQuaternion(newQuat);
|
|
91
|
-
// this.Control.update()
|
|
92
|
-
// this.World.markRenderStateDirty();
|
|
93
|
-
// }
|
|
94
|
-
|
|
95
|
-
// // focusTo
|
|
96
|
-
// // @targetPos Three.Vector3 : where your camera face to
|
|
97
|
-
// // @targetQuat Three.Quaternion or Three.Euler : rotation of your camera
|
|
98
|
-
// // @distance float : how far between targetPos and your camera's position
|
|
99
|
-
// // @time float : how long will this process finish
|
|
100
|
-
// focusTo(targetPos: Vector3, targetQuat: Quaternion | Euler, distance: number, time: number = 0, onGoing: Function | null = null, onFinished: Function | null = null)
|
|
101
|
-
// {
|
|
102
|
-
// let finalQuat = null
|
|
103
|
-
|
|
104
|
-
// if (targetQuat instanceof Euler)
|
|
105
|
-
// {
|
|
106
|
-
// finalQuat = new Quaternion().setFromEuler(targetQuat)
|
|
107
|
-
// }
|
|
108
|
-
// else
|
|
109
|
-
// {
|
|
110
|
-
// finalQuat = targetQuat
|
|
111
|
-
// }
|
|
112
|
-
// if (!targetQuat)
|
|
113
|
-
// {
|
|
114
|
-
// finalQuat = this.Camera.quaternion
|
|
115
|
-
// }
|
|
116
|
-
// finalQuat.normalize()
|
|
117
|
-
// let dir = new Vector3(0, 0, 1);
|
|
118
|
-
// dir.applyQuaternion(finalQuat).multiplyScalar(-1);
|
|
119
|
-
// dir.normalize()
|
|
120
|
-
// // quat
|
|
121
|
-
// let startQuat = this.Camera.quaternion.clone();
|
|
122
|
-
// // position
|
|
123
|
-
// let startPos = this.Camera.position.clone();
|
|
124
|
-
// let endPos = new Vector3(targetPos.x + dir.x * distance * -1, targetPos.y + dir.y * distance * -1, targetPos.z + dir.z * distance * -1);
|
|
125
|
-
|
|
126
|
-
// let posDir = new Vector3();
|
|
127
|
-
// posDir.x = endPos.x - startPos.x;
|
|
128
|
-
// posDir.y = endPos.y - startPos.y;
|
|
129
|
-
// posDir.z = endPos.z - startPos.z;
|
|
130
|
-
// let movingLength = posDir.length();
|
|
131
|
-
// posDir.normalize();
|
|
132
|
-
|
|
133
|
-
// // target
|
|
134
|
-
// let startTarget = this.Control.target.clone()
|
|
135
|
-
// let targetDir = new Vector3();
|
|
136
|
-
// targetDir.x = targetPos.x - startTarget.x;
|
|
137
|
-
// targetDir.y = targetPos.y - startTarget.y;
|
|
138
|
-
// targetDir.z = targetPos.z - startTarget.z;
|
|
139
|
-
// let targetDistance = targetDir.length();
|
|
140
|
-
// targetDir.normalize();
|
|
141
|
-
|
|
142
|
-
// this.cameraStatus.updateTargetPosition(targetPos)
|
|
143
|
-
|
|
144
|
-
// // start animation
|
|
145
|
-
// if (this.anim)
|
|
146
|
-
// {
|
|
147
|
-
// this.anim.kill();
|
|
148
|
-
// }
|
|
149
|
-
// if (movingLength + targetDistance < 0.1)
|
|
150
|
-
// {
|
|
151
|
-
// return
|
|
152
|
-
// }
|
|
153
|
-
// //this.enabled = false;
|
|
154
|
-
// let obj = {alpha: 0}
|
|
155
|
-
// let _this = this
|
|
156
|
-
// this.anim = gsap.to(obj, {
|
|
157
|
-
// duration : time,
|
|
158
|
-
// alpha : 1,
|
|
159
|
-
// onUpdate : () =>
|
|
160
|
-
// {
|
|
161
|
-
// let alpha = obj.alpha;
|
|
162
|
-
// let camPos = new Vector3(startPos.x + posDir.x * alpha * movingLength, startPos.y + posDir.y * alpha * movingLength, startPos.z + posDir.z * alpha * movingLength)
|
|
163
|
-
// let targetPos = new Vector3(startTarget.x + targetDir.x * alpha * targetDistance, startTarget.y + targetDir.y * alpha * targetDistance, startTarget.z + targetDir.z * alpha * targetDistance)
|
|
164
|
-
// _this.Control.object.position.copy(camPos);
|
|
165
|
-
// _this.Control.target.copy(targetPos);
|
|
166
|
-
|
|
167
|
-
// _this.Control.update();
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// if (onGoing)
|
|
171
|
-
// {
|
|
172
|
-
// onGoing()
|
|
173
|
-
// }
|
|
174
|
-
// _this.World.markRenderStateDirty();
|
|
175
|
-
// },
|
|
176
|
-
// onComplete: function ()
|
|
177
|
-
// {
|
|
178
|
-
// //_this.enabled = true;
|
|
179
|
-
|
|
180
|
-
// if (onFinished)
|
|
181
|
-
// {
|
|
182
|
-
// onFinished()
|
|
183
|
-
// }
|
|
184
|
-
// _this.World.markRenderStateDirty();
|
|
185
|
-
// }
|
|
186
|
-
// });
|
|
187
|
-
// }
|
|
188
|
-
|
|
189
|
-
// stopFocusing()
|
|
190
|
-
// {
|
|
191
|
-
// if (this.anim)
|
|
192
|
-
// {
|
|
193
|
-
// this.anim.kill();
|
|
194
|
-
// this.anim = null
|
|
195
|
-
// }
|
|
196
|
-
// //this.enabled = true
|
|
197
|
-
// }
|
|
198
|
-
|
|
199
|
-
// startLockCameraRotation(axis: Vector2)
|
|
200
|
-
// {
|
|
201
|
-
// this.minAzimuthAngle = this.Control.minAzimuthAngle
|
|
202
|
-
// this.maxAzimuthAngle = this.Control.maxAzimuthAngle
|
|
203
|
-
// this.minPolarAngle = this.Control.minPolarAngle
|
|
204
|
-
// this.maxPolarAngle = this.Control.maxPolarAngle
|
|
205
|
-
|
|
206
|
-
// if (axis.x === 1)
|
|
207
|
-
// {
|
|
208
|
-
// const curAngle = this.Control.getPolarAngle()
|
|
209
|
-
// this.Control.minPolarAngle = curAngle
|
|
210
|
-
// this.Control.maxPolarAngle = curAngle
|
|
211
|
-
// }
|
|
212
|
-
// else
|
|
213
|
-
// {
|
|
214
|
-
// const curAngle = this.Control.getAzimuthalAngle()
|
|
215
|
-
// this.Control.minAzimuthAngle = curAngle
|
|
216
|
-
// this.Control.maxAzimuthAngle = curAngle
|
|
217
|
-
// }
|
|
218
|
-
// }
|
|
219
|
-
|
|
220
|
-
// stopLockCameraRotation()
|
|
221
|
-
// {
|
|
222
|
-
// this.Control.minAzimuthAngle = this.minAzimuthAngle
|
|
223
|
-
// this.Control.maxAzimuthAngle = this.maxAzimuthAngle
|
|
224
|
-
// this.Control.minPolarAngle = this.minPolarAngle
|
|
225
|
-
// this.Control.maxPolarAngle = this.maxPolarAngle
|
|
226
|
-
// }
|
|
227
|
-
|
|
228
|
-
// zoomIn()
|
|
229
|
-
// {
|
|
230
|
-
// this.focusTo(this.cameraStatus.targetPosition, this.cameraStatus.cameraQuaternion, this.cameraStatus.targetPosition.clone().sub(this.cameraStatus.cameraPosition).length() * 0.9)
|
|
231
|
-
// }
|
|
232
|
-
|
|
233
|
-
// zoomOut()
|
|
234
|
-
// {
|
|
235
|
-
// this.focusTo(this.cameraStatus.targetPosition, this.cameraStatus.cameraQuaternion, this.cameraStatus.targetPosition.clone().sub(this.cameraStatus.cameraPosition).length() * 1.1)
|
|
236
|
-
// }
|
|
237
|
-
|
|
238
|
-
// restore(status: PersepecticeCameraStatus)
|
|
239
|
-
// {
|
|
240
|
-
// super.restore(status);
|
|
241
|
-
// this.cameraStatus.copy(status)
|
|
242
|
-
|
|
243
|
-
// this.focusTo(status.targetPosition, status.cameraQuaternion, status.targetPosition.clone().sub(status.cameraPosition).length())
|
|
244
|
-
// this.Camera.near = status.near
|
|
245
|
-
// this.Camera.far = status.far
|
|
246
|
-
// this.Camera.fov = status.fov
|
|
247
|
-
|
|
248
|
-
// }
|
|
249
|
-
|
|
250
|
-
// protected onChangeEvent()
|
|
251
|
-
// {
|
|
252
|
-
// super.onChangeEvent();
|
|
253
|
-
|
|
254
|
-
// this.World.markRenderStateDirty()
|
|
255
|
-
// this.onChangeOnce = []
|
|
256
|
-
|
|
257
|
-
// this.cameraStatus.update(this.Camera, this.Control.target)
|
|
258
|
-
// let camPos = this.Control.object.position.clone()
|
|
259
|
-
// let targetPos = this.Control.target.clone()
|
|
260
|
-
// }
|
|
261
|
-
|
|
262
|
-
// destroy()
|
|
263
|
-
// {
|
|
264
|
-
// if (this.anim)
|
|
265
|
-
// {
|
|
266
|
-
// this.anim.kill();
|
|
267
|
-
// this.anim = null
|
|
268
|
-
// }
|
|
269
|
-
// if (this.Control)
|
|
270
|
-
// {
|
|
271
|
-
// this.Control.removeEventListener("change", this.changeEvent)
|
|
272
|
-
// this.Control.dispose();
|
|
273
|
-
// }
|
|
274
|
-
// super.destroy();
|
|
275
|
-
// }
|
|
276
|
-
// }
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
// import {BaseObject} from "../BaseObject.js";
|
|
2
|
-
// import {Quaternion, Vector3, Camera, Euler, Vector2} from "three";
|
|
3
|
-
// import {LYThreeWorld} from "../../Frame";
|
|
4
|
-
// import {ICameraStatus, CameraStatus} from "./CameraStatus";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// // Base class for control method, should not be used directly
|
|
8
|
-
// export class PawnBase extends BaseObject implements ICameraStatus
|
|
9
|
-
// {
|
|
10
|
-
// protected control
|
|
11
|
-
// protected world: LYThreeWorld
|
|
12
|
-
// protected camera: Camera
|
|
13
|
-
// protected cameraStatus:CameraStatus
|
|
14
|
-
// protected onCameraMove:Function|null = null
|
|
15
|
-
|
|
16
|
-
// protected onChangeOnce:Function[] = []
|
|
17
|
-
// protected onChange:Function[] = []
|
|
18
|
-
|
|
19
|
-
// protected changeEvent:Function
|
|
20
|
-
|
|
21
|
-
// constructor(world: LYThreeWorld, camera: Camera, control)
|
|
22
|
-
// {
|
|
23
|
-
// super();
|
|
24
|
-
// this.control = control;
|
|
25
|
-
// this.world = world
|
|
26
|
-
// this.camera = camera
|
|
27
|
-
// // this.cameraStatus = new CameraStatus(this.Camera.position, this.Camera.quaternion, this.Camera.position, 1)
|
|
28
|
-
|
|
29
|
-
// this.onChange = []
|
|
30
|
-
// this.onChangeOnce = []
|
|
31
|
-
// this.changeEvent = ()=>{
|
|
32
|
-
// this.onChangeEvent()
|
|
33
|
-
// }
|
|
34
|
-
// }
|
|
35
|
-
|
|
36
|
-
// get CameraStatus():CameraStatus
|
|
37
|
-
// {
|
|
38
|
-
// return this.cameraStatus
|
|
39
|
-
// }
|
|
40
|
-
|
|
41
|
-
// tick(deltaTime)
|
|
42
|
-
// {
|
|
43
|
-
// super.tick(deltaTime)
|
|
44
|
-
// }
|
|
45
|
-
|
|
46
|
-
// possess()
|
|
47
|
-
// {
|
|
48
|
-
|
|
49
|
-
// }
|
|
50
|
-
|
|
51
|
-
// unpossess()
|
|
52
|
-
// {
|
|
53
|
-
// this.onChange = []
|
|
54
|
-
// this.onChangeOnce = []
|
|
55
|
-
// }
|
|
56
|
-
|
|
57
|
-
// set enabled(newEnable:boolean)
|
|
58
|
-
// {
|
|
59
|
-
|
|
60
|
-
// }
|
|
61
|
-
|
|
62
|
-
// startLockCameraRotation(axis: Vector2)
|
|
63
|
-
// {
|
|
64
|
-
|
|
65
|
-
// }
|
|
66
|
-
// restore(status: CameraStatus) {}
|
|
67
|
-
|
|
68
|
-
// stopLockCameraRotation()
|
|
69
|
-
// {
|
|
70
|
-
|
|
71
|
-
// }
|
|
72
|
-
|
|
73
|
-
// setPosition(param1, param2 = undefined, param3 = undefined)
|
|
74
|
-
// {
|
|
75
|
-
// if (param1 instanceof Vector3)
|
|
76
|
-
// {
|
|
77
|
-
// this.Camera.position.set(param1.x, param1.y, param1.z);
|
|
78
|
-
// }
|
|
79
|
-
// if (typeof (param1) === "number" && typeof (param2) === "number" && typeof (param3) === "number")
|
|
80
|
-
// {
|
|
81
|
-
// this.Camera.position.set(param1, param2, param3);
|
|
82
|
-
// }
|
|
83
|
-
|
|
84
|
-
// if (this.world)
|
|
85
|
-
// {
|
|
86
|
-
// this.world.markRenderStateDirty();
|
|
87
|
-
// }
|
|
88
|
-
// }
|
|
89
|
-
|
|
90
|
-
// setQuaternion(newQuat)
|
|
91
|
-
// {
|
|
92
|
-
// if (newQuat instanceof Quaternion)
|
|
93
|
-
// {
|
|
94
|
-
// this.Camera.rotation.setFromQuaternion(newQuat);
|
|
95
|
-
// if (this.world)
|
|
96
|
-
// {
|
|
97
|
-
// this.world.markRenderStateDirty();
|
|
98
|
-
// }
|
|
99
|
-
// }
|
|
100
|
-
// }
|
|
101
|
-
|
|
102
|
-
// get Camera()
|
|
103
|
-
// {
|
|
104
|
-
// return this.camera
|
|
105
|
-
// }
|
|
106
|
-
|
|
107
|
-
// setCamera(newCamera)
|
|
108
|
-
// {
|
|
109
|
-
|
|
110
|
-
// }
|
|
111
|
-
|
|
112
|
-
// get Control()
|
|
113
|
-
// {
|
|
114
|
-
// return this.control
|
|
115
|
-
// }
|
|
116
|
-
|
|
117
|
-
// get World()
|
|
118
|
-
// {
|
|
119
|
-
// return this.world;
|
|
120
|
-
// }
|
|
121
|
-
|
|
122
|
-
// focusTo(targetPos: Vector3, targetQuat: Quaternion | Euler, distance: number, time: number, onGoing: Function | null = null, onFinished: Function | null = null)
|
|
123
|
-
// {
|
|
124
|
-
|
|
125
|
-
// }
|
|
126
|
-
|
|
127
|
-
// moveTo(targetPos: Vector3)
|
|
128
|
-
// {
|
|
129
|
-
|
|
130
|
-
// }
|
|
131
|
-
|
|
132
|
-
// stopFocusing()
|
|
133
|
-
// {
|
|
134
|
-
|
|
135
|
-
// }
|
|
136
|
-
// destroy()
|
|
137
|
-
// {
|
|
138
|
-
// this.unpossess()
|
|
139
|
-
// if (this.control)
|
|
140
|
-
// {
|
|
141
|
-
// this.control = null;
|
|
142
|
-
// }
|
|
143
|
-
// super.destroy();
|
|
144
|
-
// }
|
|
145
|
-
|
|
146
|
-
// zoomIn()
|
|
147
|
-
// {
|
|
148
|
-
|
|
149
|
-
// }
|
|
150
|
-
|
|
151
|
-
// zoomOut()
|
|
152
|
-
// {
|
|
153
|
-
|
|
154
|
-
// }
|
|
155
|
-
|
|
156
|
-
// protected onChangeEvent()
|
|
157
|
-
// {
|
|
158
|
-
// for (let i = 0; i < this.onChange.length; ++i)
|
|
159
|
-
// {
|
|
160
|
-
// this.onChange[i]();
|
|
161
|
-
// }
|
|
162
|
-
// for (let i = 0; i < this.onChangeOnce.length; ++i)
|
|
163
|
-
// {
|
|
164
|
-
// this.onChangeOnce[i]();
|
|
165
|
-
// }
|
|
166
|
-
// this.onChangeOnce = []
|
|
167
|
-
// }
|
|
168
|
-
|
|
169
|
-
// addOnChangeEvent(event, bOnce = false)
|
|
170
|
-
// {
|
|
171
|
-
// if (bOnce)
|
|
172
|
-
// {
|
|
173
|
-
// this.onChangeOnce.push(event)
|
|
174
|
-
// }
|
|
175
|
-
// else
|
|
176
|
-
// {
|
|
177
|
-
// this.onChange.push(event)
|
|
178
|
-
// }
|
|
179
|
-
// }
|
|
180
|
-
|
|
181
|
-
// removeOnChangeEvent(event)
|
|
182
|
-
// {
|
|
183
|
-
// let index = this.onChange.indexOf(event)
|
|
184
|
-
// if (index >= 0)
|
|
185
|
-
// {
|
|
186
|
-
// this.onChange.splice(index, 1);
|
|
187
|
-
// }
|
|
188
|
-
// }
|
|
189
|
-
// }
|
|
@@ -1,205 +0,0 @@
|
|
|
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
|
-
// }
|