lythreeframe 1.0.5 → 1.0.7

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.
Files changed (136) hide show
  1. package/dist/bundle.cjs.js +2782 -0
  2. package/dist/bundle.esm.js +2747 -0
  3. package/dist/index.d.ts +42 -0
  4. package/dist/lythreeframe/AssetManagement/AssetDefines.d.ts +6 -0
  5. package/dist/lythreeframe/AssetManagement/AssetManager.d.ts +23 -0
  6. package/dist/lythreeframe/AssetManagement/AssetPointer/AssetPointer.d.ts +9 -0
  7. package/dist/lythreeframe/AssetManagement/Task/Task.d.ts +7 -0
  8. package/dist/lythreeframe/Container/SmartPointer.d.ts +10 -0
  9. package/dist/lythreeframe/Defines.d.ts +4 -0
  10. package/dist/lythreeframe/Delegate.d.ts +8 -0
  11. package/dist/lythreeframe/Factory/CameraFactory.d.ts +20 -0
  12. package/dist/lythreeframe/Factory/RendererFactory.d.ts +2 -0
  13. package/dist/lythreeframe/Frame/Controller.d.ts +40 -0
  14. package/dist/lythreeframe/Frame/Viewport.d.ts +50 -0
  15. package/dist/lythreeframe/Frame/World.d.ts +18 -0
  16. package/dist/lythreeframe/Geometry/PlaneGeometry.d.ts +3 -0
  17. package/dist/lythreeframe/Geometry/TriangleGeometry.d.ts +3 -0
  18. package/dist/lythreeframe/Library/ContainerLibrary.d.ts +3 -0
  19. package/dist/lythreeframe/Library/Math.d.ts +27 -0
  20. package/dist/lythreeframe/Library/ResourceLibrary.d.ts +6 -0
  21. package/dist/lythreeframe/Object/Actor.d.ts +86 -0
  22. package/dist/lythreeframe/Object/Actors/Camera/CameraActor.d.ts +4 -0
  23. package/dist/lythreeframe/Object/Actors/Light/DirectionalLightActor.d.ts +7 -0
  24. package/dist/lythreeframe/Object/Actors/Shape/BoxActor.d.ts +5 -0
  25. package/dist/lythreeframe/Object/Actors/Shape/PlaneActor.d.ts +9 -0
  26. package/dist/lythreeframe/Object/BaseObject.d.ts +10 -0
  27. package/dist/lythreeframe/Object/Components/2D/2DComponent.d.ts +13 -0
  28. package/dist/lythreeframe/Object/Components/Camera/CameraComponent.d.ts +26 -0
  29. package/dist/lythreeframe/Object/Components/Component.d.ts +17 -0
  30. package/dist/lythreeframe/Object/Components/Light/DirectionalLight/DirectionalLightComponent.d.ts +15 -0
  31. package/dist/lythreeframe/Object/Components/Light/LightComponent.d.ts +12 -0
  32. package/dist/lythreeframe/Object/Components/Mesh/InstanceMesh/InstanceMeshComponent.d.ts +7 -0
  33. package/dist/lythreeframe/Object/Components/Mesh/InstanceMesh/MultiInstanceMeshComponent.d.ts +13 -0
  34. package/dist/lythreeframe/Object/Components/Mesh/MeshComponent.d.ts +22 -0
  35. package/dist/lythreeframe/Object/Components/Mesh/Shape/BoxComponent.d.ts +5 -0
  36. package/dist/lythreeframe/Object/Components/Mesh/Shape/PlaneComponent.d.ts +5 -0
  37. package/dist/lythreeframe/Object/Components/Mesh/Shape/SphereComponent.d.ts +5 -0
  38. package/dist/lythreeframe/Object/Components/Mesh/Sprite/SpriteComponent.d.ts +8 -0
  39. package/dist/lythreeframe/Object/Components/SceneComponent.d.ts +66 -0
  40. package/dist/lythreeframe/Object/PawnV2/FirstPerson.d.ts +5 -0
  41. package/dist/lythreeframe/Object/PawnV2/Oribital.d.ts +12 -0
  42. package/dist/lythreeframe/Object/PawnV2/Pawn.d.ts +14 -0
  43. package/dist/lythreeframe/Object/PawnV2/TransformControl.d.ts +46 -0
  44. package/dist/lythreeframe/PostProcess/Param/Bloom.d.ts +6 -0
  45. package/dist/lythreeframe/PostProcess/Param/DOF.d.ts +6 -0
  46. package/dist/lythreeframe/PostProcess/Param/Denoise.d.ts +7 -0
  47. package/dist/lythreeframe/PostProcess/Param/GTAO.d.ts +11 -0
  48. package/dist/lythreeframe/PostProcess/Param/LensFlare.d.ts +6 -0
  49. package/dist/lythreeframe/PostProcess/Param/MotionBlur.d.ts +4 -0
  50. package/dist/lythreeframe/PostProcess/Param/Outline.d.ts +17 -0
  51. package/dist/lythreeframe/PostProcess/Param/SSR.d.ts +6 -0
  52. package/dist/lythreeframe/PostProcess/Param/ToneMapping.d.ts +9 -0
  53. package/dist/lythreeframe/PostProcess/PostProcessParam.d.ts +16 -0
  54. package/dist/lythreeframe/PostProcess/WebGPUPostProcessFactory.d.ts +43 -0
  55. package/dist/lythreeframe/Shader/Postprocess/ColorShader.d.ts +29 -0
  56. package/dist/lythreeframe/ThreeJsApp.d.ts +35 -0
  57. package/package.json +26 -14
  58. package/dist/index.ts +0 -80
  59. package/rollup.config.js +0 -31
  60. package/src/draco/README.md +0 -32
  61. package/src/draco/draco_decoder.js +0 -34
  62. package/src/draco/draco_decoder.wasm +0 -0
  63. package/src/draco/draco_encoder.js +0 -33
  64. package/src/draco/draco_wasm_wrapper.js +0 -117
  65. package/src/draco/gltf/draco_decoder.js +0 -33
  66. package/src/draco/gltf/draco_decoder.wasm +0 -0
  67. package/src/draco/gltf/draco_encoder.js +0 -33
  68. package/src/draco/gltf/draco_wasm_wrapper.js +0 -116
  69. package/src/index.ts +0 -44
  70. package/src/lythreeframe/AssetManagement/AssetDefines.ts +0 -8
  71. package/src/lythreeframe/AssetManagement/AssetManager.ts +0 -288
  72. package/src/lythreeframe/AssetManagement/AssetPointer/AssetPointer.ts +0 -41
  73. package/src/lythreeframe/AssetManagement/Task/Task.ts +0 -24
  74. package/src/lythreeframe/Container/SmartPointer.ts +0 -54
  75. package/src/lythreeframe/Defines.ts +0 -11
  76. package/src/lythreeframe/Delegate.ts +0 -37
  77. package/src/lythreeframe/Factory/CameraFactory.ts +0 -81
  78. package/src/lythreeframe/Factory/RendererFactory.ts +0 -7
  79. package/src/lythreeframe/Frame/Controller.ts +0 -261
  80. package/src/lythreeframe/Frame/Viewport.ts +0 -516
  81. package/src/lythreeframe/Frame/World.ts +0 -59
  82. package/src/lythreeframe/Frame.ts +0 -511
  83. package/src/lythreeframe/Geometry/PlaneGeometry.ts +0 -53
  84. package/src/lythreeframe/Geometry/TriangleGeometry.ts +0 -50
  85. package/src/lythreeframe/Library/ContainerLibrary.ts +0 -21
  86. package/src/lythreeframe/Library/MaterialLibrary.ts +0 -292
  87. package/src/lythreeframe/Library/Math.ts +0 -154
  88. package/src/lythreeframe/Library/ResourceLibrary.ts +0 -21
  89. package/src/lythreeframe/Object/Actor.ts +0 -571
  90. package/src/lythreeframe/Object/Actors/Camera/CameraActor.ts +0 -11
  91. package/src/lythreeframe/Object/Actors/Light/DirectionalLightActor.ts +0 -18
  92. package/src/lythreeframe/Object/Actors/Shape/BoxActor.ts +0 -20
  93. package/src/lythreeframe/Object/Actors/Shape/CurveActor.ts +0 -11
  94. package/src/lythreeframe/Object/Actors/Shape/PlaneActor.ts +0 -27
  95. package/src/lythreeframe/Object/Actors/Shape/TubeActor.ts +0 -37
  96. package/src/lythreeframe/Object/BaseObject.ts +0 -45
  97. package/src/lythreeframe/Object/Components/2D/2DComponent.ts +0 -64
  98. package/src/lythreeframe/Object/Components/Camera/CameraComponent.ts +0 -113
  99. package/src/lythreeframe/Object/Components/Component.ts +0 -67
  100. package/src/lythreeframe/Object/Components/Light/DirectionalLight/DirectionalLightComponent.ts +0 -78
  101. package/src/lythreeframe/Object/Components/Light/LightComponent.ts +0 -54
  102. package/src/lythreeframe/Object/Components/Mesh/InstanceMesh/InstanceMeshComponent.ts +0 -39
  103. package/src/lythreeframe/Object/Components/Mesh/InstanceMesh/MultiInstanceMeshComponent.ts +0 -115
  104. package/src/lythreeframe/Object/Components/Mesh/Line/CurveComponent.ts +0 -221
  105. package/src/lythreeframe/Object/Components/Mesh/MeshComponent.ts +0 -162
  106. package/src/lythreeframe/Object/Components/Mesh/Shape/BoxComponent.ts +0 -17
  107. package/src/lythreeframe/Object/Components/Mesh/Shape/PlaneComponent.ts +0 -10
  108. package/src/lythreeframe/Object/Components/Mesh/Shape/SphereComponent.ts +0 -10
  109. package/src/lythreeframe/Object/Components/Mesh/Sprite/SpriteComponent.ts +0 -32
  110. package/src/lythreeframe/Object/Components/SceneComponent.ts +0 -811
  111. package/src/lythreeframe/Object/Controller/Controller.ts +0 -764
  112. package/src/lythreeframe/Object/Pawn/CameraStatus.ts +0 -262
  113. package/src/lythreeframe/Object/Pawn/FirstPerson.ts +0 -230
  114. package/src/lythreeframe/Object/Pawn/Oribital.ts +0 -276
  115. package/src/lythreeframe/Object/Pawn/PawnBase.ts +0 -189
  116. package/src/lythreeframe/Object/Pawn/TopView.ts +0 -205
  117. package/src/lythreeframe/Object/Pawn/TransformControl.ts +0 -215
  118. package/src/lythreeframe/Object/Pawn/staticCamera.ts +0 -80
  119. package/src/lythreeframe/Object/PawnV2/FirstPerson.ts +0 -12
  120. package/src/lythreeframe/Object/PawnV2/Oribital.ts +0 -45
  121. package/src/lythreeframe/Object/PawnV2/Pawn.ts +0 -50
  122. package/src/lythreeframe/Object/PawnV2/TransformControl.ts +0 -202
  123. package/src/lythreeframe/PostProcess/Param/Bloom.ts +0 -12
  124. package/src/lythreeframe/PostProcess/Param/DOF.ts +0 -13
  125. package/src/lythreeframe/PostProcess/Param/Denoise.ts +0 -14
  126. package/src/lythreeframe/PostProcess/Param/GTAO.ts +0 -21
  127. package/src/lythreeframe/PostProcess/Param/LensFlare.ts +0 -11
  128. package/src/lythreeframe/PostProcess/Param/MotionBlur.ts +0 -8
  129. package/src/lythreeframe/PostProcess/Param/Outline.ts +0 -20
  130. package/src/lythreeframe/PostProcess/Param/SSR.ts +0 -11
  131. package/src/lythreeframe/PostProcess/Param/ToneMapping.ts +0 -31
  132. package/src/lythreeframe/PostProcess/PostProcessParam.ts +0 -26
  133. package/src/lythreeframe/PostProcess/WebGPUPostProcessFactory.ts +0 -217
  134. package/src/lythreeframe/Shader/Postprocess/ColorShader.ts +0 -49
  135. package/src/lythreeframe/ThreeJsApp.ts +0 -124
  136. package/tsconfig.json +0 -105
@@ -1,764 +0,0 @@
1
-
2
- // import {LYRaycaster} from '../Raycast/Raycaster';
3
- // import {PerspectiveCamera, Quaternion, Vector2, Camera, Object3D, Vector3, Mesh} from "three";
4
- // import {LYOrbital} from "../Pawn/Oribital";
5
- // import {ITransforming, LYTransformControl} from "../Pawn/TransformControl";
6
- // import {LYDelegate} from "../../Delegate";
7
- // import {LYThreeWorld} from "../../Frame";
8
-
9
- // import {SceneComponent} from "../Components/SceneComponent";
10
- // import {PawnBase} from "../Pawn/PawnBase";
11
-
12
- // const maxClickTime = 0.15; // The time between left mouse button down and left mouse button up if greater than this, will not trigger click event.
13
-
14
- // // forever tick
15
- // export class LYController
16
- // {
17
- // protected hoverable: SceneComponent[] = []
18
- // protected clickable: SceneComponent[] = []
19
- // protected blockingMesh: Mesh[] = []
20
- // protected world:LYThreeWorld
21
- // protected pawn: PawnBase | null = null
22
- // protected cameraStat
23
- // protected camera: Camera | null
24
- // protected transformControl
25
- // protected onClickNullEvent: Function[] = []
26
- // protected bLeftMouseButtonDown: boolean = false
27
- // protected leftMouseButtonDownTime: number = 0
28
-
29
- // protected onMouseUpDelegate: LYDelegate = new LYDelegate();
30
- // protected onMouseMoveDelegate: LYDelegate = new LYDelegate();
31
- // protected onMouseEnterDelegate: LYDelegate = new LYDelegate();
32
- // protected onMouseLeaveDelegate: LYDelegate = new LYDelegate();
33
-
34
- // protected resizeObserver
35
- // protected onPointerUpFunc: Function
36
- // protected onPointerDownFunc: Function
37
- // protected onPointerMoveFunc: Function
38
- // protected onPointerEnterFunc: Function
39
- // protected onPointerLeaveFunc: Function
40
-
41
- // protected pointer: Vector2;
42
- // private hoveringComp: SceneComponent[] = [];
43
-
44
- // private ray = null;
45
- // public bLockCameraRotationByMouseMove: boolean = false;
46
- // public bCameraRotationLockedAlready: boolean = true;
47
- // private startPointerDownPos: Vector2;
48
-
49
- // protected onCameraMoveEvents: Function[] = []
50
- // private onCameraMove: Function
51
- // private onCameraChangedDelegate: LYDelegate = new LYDelegate()
52
-
53
- // get hoverDepth(): number
54
- // {
55
- // return this._hoverDepth;
56
- // }
57
-
58
- // set hoverDepth(value: number)
59
- // {
60
- // this._hoverDepth = Math.floor(value);
61
- // }
62
-
63
- // private _hoverDepth: number = 1;
64
-
65
- // constructor(world: LYThreeWorld)
66
- // {
67
-
68
- // this.world = world
69
-
70
-
71
- // this.transformControl = null;
72
-
73
- // this.pointer = new Vector2();
74
-
75
- // this.ray = null
76
- // this.hoverable = [];
77
- // this.clickable = []
78
-
79
- // this.cameraStat = null;
80
-
81
- // this.IsTickable = true;
82
-
83
- // this.leftMouseButtonDownTime = 0;
84
- // this.bLeftMouseButtonDown = false;
85
-
86
- // this.onPointerMoveFunc = () =>
87
- // {
88
- // this.onPointerMove(event)
89
- // };
90
- // this.onPointerDownFunc = () =>
91
- // {
92
- // this.onPointerDown(event)
93
- // };
94
- // this.onPointerUpFunc = () =>
95
- // {
96
- // this.onPointerUp(event)
97
- // };
98
- // this.onPointerEnterFunc = () =>
99
- // {
100
- // this.onMouseEnterCanvas()
101
- // };
102
- // this.onPointerLeaveFunc = () =>
103
- // {
104
- // this.onMouseLeaveCanvas()
105
- // };
106
- // this.onCameraMove = () =>
107
- // {
108
- // this.onCameraMoveEvents.forEach((elem) =>
109
- // {
110
- // elem()
111
- // })
112
- // }
113
- // this.switchPawnMode(new LYOrbital(this.world))
114
-
115
- // }
116
-
117
- // init()
118
- // {
119
- // // if (!this.camera)
120
- // // {
121
- // // let ele = this.world.Element;
122
- // // this.switchCamera(new PerspectiveCamera(90, ele.clientWidth / ele.clientHeight, 0.5, 7000))
123
- // // }
124
- // // if (!this.pawn)
125
- // // {
126
- // // this.pawn = new LYOrbital(this.world, this.Camera);
127
- // // this.pawn.possess(this.onCameraMove);
128
- // // }
129
-
130
- // this.resizeObserver = new ResizeObserver((entries) =>
131
- // {
132
- // for (let entry of entries)
133
- // {
134
- // if (entry.contentBoxSize)
135
- // {
136
- // this.onWindowResize()
137
- // }
138
- // }
139
- // });
140
- // this.resizeObserver.observe(this.world.OuterElement);
141
-
142
- // this.onMouseEnterCanvas()
143
- // let ele = this.world.Element
144
- // ele.addEventListener('mouseenter', this.onPointerEnterFunc);
145
- // ele.addEventListener("mouseleave", this.onPointerLeaveFunc);
146
- // }
147
-
148
-
149
- // addCameraMoveEvent(newFunc: Function)
150
- // {
151
- // this.onCameraMoveEvents.push(newFunc)
152
- // }
153
-
154
- // removeCameraMoveEvent(target: Function)
155
- // {
156
- // let index = this.onCameraMoveEvents.indexOf(target)
157
- // if (index >= 0)
158
- // {
159
- // this.onCameraMoveEvents.splice(index, 1)
160
- // }
161
- // }
162
-
163
- // get OnMouseUp()
164
- // {
165
- // return this.onMouseUpDelegate
166
- // }
167
-
168
- // get OnMouseMove()
169
- // {
170
- // return this.onMouseMoveDelegate
171
- // }
172
-
173
- // get onMouseEnter()
174
- // {
175
- // return this.onMouseEnterDelegate
176
- // }
177
-
178
- // get onMouseLeave()
179
- // {
180
- // return this.onMouseLeaveDelegate
181
- // }
182
-
183
- // // forever tick
184
- // set IsTickable(bCanTick)
185
- // {
186
- // super.IsTickable = true;
187
- // }
188
-
189
- // // tick function, not supposed to be called
190
- // tick(deltaTime:number)
191
- // {
192
-
193
- // if (this.pawn)
194
- // {
195
- // this.pawn.tick(deltaTime)
196
- // }
197
- // if (this.transformControl)
198
- // {
199
- // this.transformControl.tick(deltaTime)
200
-
201
- // }
202
- // if (this.bLeftMouseButtonDown)
203
- // {
204
- // this.leftMouseButtonDownTime += deltaTime
205
- // }
206
- // }
207
-
208
- // // current camera
209
- // get Camera(): Camera | null
210
- // {
211
- // return this.pawn?.Camera || null;
212
- // }
213
-
214
- // get onCameraChanged(): LYDelegate
215
- // {
216
- // return this.onCameraChangedDelegate
217
- // }
218
-
219
- // // control method
220
- // get PawnMode()
221
- // {
222
- // return this.pawn
223
- // }
224
-
225
- // switchPawnMode(newPawn: PawnBase)
226
- // {
227
- // let oldPawn = this.pawn
228
-
229
- // this.pawn = newPawn
230
- // if (oldPawn)
231
- // {
232
- // oldPawn.unpossess();
233
- // oldPawn.destroy();
234
- // }
235
- // this.pawn.addOnChangeEvent(this.onCameraMove)
236
- // this.pawn.possess();
237
- // this.onCameraChanged.broadcast()
238
-
239
- // this.world.markRenderStateDirty();
240
- // }
241
-
242
- // // transform position
243
- // setPosition(param1, param2 = undefined, param3 = undefined)
244
- // {
245
- // if (this.pawn)
246
- // {
247
- // this.pawn.setPosition(param1, param2, param3)
248
- // this.world.markRenderStateDirty();
249
- // }
250
- // }
251
-
252
- // // transform quaternion
253
- // setQuaternion(newQuat)
254
- // {
255
- // if (this.pawn)
256
- // {
257
- // this.pawn.setQuaternion(newQuat)
258
- // this.world.markRenderStateDirty();
259
- // }
260
- // }
261
-
262
- // // transform euler
263
- // setRotation(newEuler)
264
- // {
265
- // if (this.pawn)
266
- // {
267
- // this.pawn.setQuaternion(new Quaternion().setFromEuler(newEuler))
268
- // this.world.markRenderStateDirty();
269
- // }
270
- // }
271
-
272
- // // focus
273
- // focusTo(targetPos, targetQuat, distance, time, onGoing: Function | null = null, onFinished: Function | null = null)
274
- // {
275
- // this.pawn.focusTo(targetPos, targetQuat, distance, time, onGoing, onFinished)
276
- // }
277
-
278
- // movePawnTo(targetPos: Vector3)
279
- // {
280
-
281
- // }
282
-
283
- // enableTransformControl(primaryTarget: ITransforming, multiTargets: ITransforming[], onUpdate: Function | null = null, onDragging: Function | null)
284
- // {
285
- // if (this.transformControl)
286
- // {
287
- // this.disableTransformControl()
288
- // }
289
- // this.transformControl = new LYTransformControl(this.world, this.Camera)
290
- // this.transformControl.possess()
291
- // this.transformControl.setSpace("local")
292
- // this.transformControl.setTarget(primaryTarget, multiTargets, onUpdate, onDragging)
293
- // this.transformControl.setAxis(primaryTarget.getAllowedTransformType().translate)
294
- // this.world?.markRenderStateDirty()
295
- // }
296
-
297
-
298
-
299
- // disableTransformControl()
300
- // {
301
- // if (this.transformControl)
302
- // {
303
- // this.transformControl.destroy();
304
- // }
305
- // this.transformControl = null
306
- // this.world?.markRenderStateDirty()
307
- // }
308
-
309
- // getTransformToolMode(): "translate" | "rotate" | "scale"
310
- // {
311
- // return this.transformControl.getMode()
312
- // }
313
-
314
- // setTransformToolMode(mode: "translate" | "rotate" | "scale"): void
315
- // {
316
- // this.transformControl.setMode(mode)
317
- // }
318
-
319
- // setTransformToolAxis(axis: "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null): void
320
- // {
321
- // this.transformControl.setAxis(axis)
322
- // }
323
-
324
-
325
- // onWindowResize()
326
- // {
327
- // let ele = this.world.OuterElement;
328
- // if (!ele)
329
- // {
330
- // return
331
- // }
332
- // this.Camera.aspect = ele.clientWidth / ele.clientHeight;
333
- // this.Camera.updateProjectionMatrix();
334
- // this.world.renderer.setSize(ele.clientWidth, ele.clientHeight);
335
- // this.world.labelRenderer.setSize(ele.clientWidth, ele.clientHeight);
336
- // if (this.world.Composer)
337
- // {
338
- // this.world.Composer.setSize(ele.clientWidth, ele.clientHeight)
339
- // }
340
- // this.world.markRenderStateDirty();
341
- // }
342
-
343
- // onPointerMove(event)
344
- // {
345
- // let ele = this.world.OuterElement;
346
- // const canvasRect = this.world.Element.getBoundingClientRect();
347
- // const offsetX = canvasRect.left;
348
- // const offsetY = canvasRect.top;
349
-
350
- // const pointer = new Vector2(((event.clientX - offsetX) / ele.clientWidth) * 2 - 1, 1 - ((event.clientY - offsetY) / ele.clientHeight) * 2)
351
-
352
- // if (event.buttons !== 0)
353
- // {
354
- // this.pawn.stopFocusing()
355
- // if (this.bLockCameraRotationByMouseMove && (!this.bCameraRotationLockedAlready))
356
- // {
357
- // const deltaX = Math.abs(pointer.x - this.startPointerDownPos.x)
358
- // const deltaY = Math.abs(pointer.y - this.startPointerDownPos.y)
359
- // if (Math.min(deltaY, deltaX) > 0.002)
360
- // {
361
- // this.bCameraRotationLockedAlready = true
362
- // this.PawnMode.startLockCameraRotation(deltaX > deltaY ? new Vector2(1, 0) : new Vector2(0, 1))
363
- // }
364
- // }
365
- // return
366
- // }
367
- // this.pointer = pointer
368
-
369
- // let hover = this.getHitResultUnderCursor(this.hoverable, this._hoverDepth)
370
- // let newHoverComp = []
371
- // hover.forEach((elem) =>
372
- // {
373
- // if (elem.hitComp)
374
- // {
375
- // newHoverComp.push(elem.hitComp)
376
- // }
377
- // })
378
-
379
- // this.hoveringComp.forEach((elem) =>
380
- // {
381
- // if (newHoverComp.indexOf(elem) < 0)
382
- // {
383
- // elem.onHorveringEnd();
384
- // }
385
- // })
386
-
387
- // newHoverComp.forEach((elem) =>
388
- // {
389
- // if (this.hoveringComp.indexOf(elem) < 0)
390
- // {
391
- // elem.onHorveringBegin();
392
- // }
393
- // })
394
-
395
- // this.hoveringComp = newHoverComp
396
-
397
- // this.OnMouseMove.broadcast(event)
398
- // }
399
-
400
- // onPointerDown(event)
401
- // {
402
- // // left mouse button
403
- // if (event.button === 0)
404
- // {
405
- // this.bLeftMouseButtonDown = true;
406
- // if (this.bLockCameraRotationByMouseMove)
407
- // {
408
- // let ele = this.world.OuterElement;
409
- // const canvasRect = this.world.Element.getBoundingClientRect();
410
- // const offsetX = canvasRect.left;
411
- // const offsetY = canvasRect.top;
412
- // this.pointer.x = ((event.clientX - offsetX) / ele.clientWidth) * 2 - 1;
413
- // this.pointer.y = 1 - ((event.clientY - offsetY) / ele.clientHeight) * 2;
414
- // this.startPointerDownPos = this.pointer.clone()
415
- // this.bCameraRotationLockedAlready = false
416
- // }
417
- // }
418
- // }
419
-
420
- // onPointerUp(event)
421
- // {
422
- // if (event.button === 0)
423
- // {
424
- // this.bLeftMouseButtonDown = false;
425
- // if (this.leftMouseButtonDownTime < maxClickTime)
426
- // {
427
- // this.onClick(event)
428
- // }
429
-
430
- // this.leftMouseButtonDownTime = 0;
431
-
432
- // this.PawnMode.stopLockCameraRotation()
433
-
434
- // this.bCameraRotationLockedAlready = true
435
- // }
436
- // this.OnMouseUp.broadcast(event)
437
- // }
438
-
439
- // onMouseEnterCanvas()
440
- // {
441
- // let ele = this.world.Element
442
- // ele.addEventListener('pointermove', this.onPointerMoveFunc);
443
- // ele.addEventListener("pointerup", this.onPointerUpFunc);
444
- // ele.addEventListener("pointerdown", this.onPointerDownFunc);
445
- // this.onMouseEnterDelegate.broadcast()
446
- // }
447
-
448
- // onMouseLeaveCanvas()
449
- // {
450
- // let ele = this.world.Element
451
- // ele.removeEventListener('pointermove', this.onPointerMoveFunc);
452
- // ele.removeEventListener("pointerup", this.onPointerUpFunc);
453
- // ele.removeEventListener("pointerdown", this.onPointerDownFunc);
454
- // this.onMouseLeaveDelegate.broadcast()
455
-
456
- // }
457
-
458
- // projectWorldPositionToScreen(pos: Vector3)
459
- // {
460
- // let temp = new Vector3().copy(pos)
461
- // temp.project(this.Camera)
462
- // let ele = this.world.Element
463
- // const width = ele.clientWidth;
464
- // const height = ele.clientHeight;
465
-
466
- // const screenX = (temp.x + 1) / 2 * width;
467
- // const screenY = (1 - temp.y) / 2 * height;
468
- // return new Vector2(screenX, screenY)
469
- // }
470
-
471
- // // excute when click nothing
472
- // addClickNullEvent(func)
473
- // {
474
- // if (!func)
475
- // {
476
- // return
477
- // }
478
- // this.onClickNullEvent.push(func)
479
- // }
480
-
481
- // removeClickNullEvent(func)
482
- // {
483
- // let index = this.onClickNullEvent.indexOf(func)
484
- // if (index >= 0)
485
- // {
486
- // this.onClickNullEvent.splice(index, 1)
487
- // }
488
- // }
489
-
490
- // onClick(event)
491
- // {
492
- // let ele = this.world.Element;
493
-
494
- // let bound = ele.getBoundingClientRect();
495
- // this.pointer.x = ((event.clientX - bound.left) / ele.offsetWidth) * 2 - 1;// 标准设备横坐标
496
- // this.pointer.y = -((event.clientY - bound.top) / ele.offsetHeight) * 2 + 1;// 标准设备纵坐标
497
-
498
- // if (this.clickable.length > 0)
499
- // {
500
- // let res = this.getHitResultUnderCursor(this.clickable)
501
-
502
- // if (res.length === 0)
503
- // {
504
- // this.onClickNullEvent.forEach((elem) =>
505
- // {
506
- // elem()
507
- // })
508
- // return
509
- // }
510
- // let hitComp = res[0].hitComp
511
- // let hitInfo = res[0].hitInfo
512
-
513
- // if (hitComp)
514
- // {
515
- // hitComp.onClicked();
516
- // }
517
- // else
518
- // {
519
- // this.onClickNullEvent.forEach((elem) =>
520
- // {
521
- // elem()
522
- // })
523
- // }
524
- // }
525
- // else
526
- // {
527
- // this.onClickNullEvent.forEach((elem) =>
528
- // {
529
- // elem()
530
- // })
531
- // }
532
- // }
533
-
534
- // addBlockable(object: Mesh)
535
- // {
536
- // let index = this.blockingMesh.indexOf(object)
537
- // if (index >= 0)
538
- // {
539
- // return
540
- // }
541
- // this.blockingMesh.push(object)
542
- // }
543
-
544
- // removeBlockable(object: Mesh)
545
- // {
546
- // let index = this.blockingMesh.indexOf(object)
547
- // if (index >= 0)
548
- // {
549
- // this.blockingMesh.splice(index, 1)
550
- // }
551
- // }
552
-
553
- // // line trace
554
- // registAsHoverable(LYObject: SceneComponent)
555
- // {
556
- // let index = this.hoverable.indexOf(LYObject)
557
- // if (index >= 0)
558
- // {
559
- // return
560
- // }
561
-
562
- // this.hoverable.push(LYObject)
563
- // }
564
-
565
- // unregistAsHoverable(LYObject: SceneComponent)
566
- // {
567
- // let index = this.hoverable.indexOf(LYObject)
568
- // if (index >= 0)
569
- // {
570
- // this.hoverable.splice(index, 1)
571
- // }
572
- // }
573
-
574
- // registAsClickable(LYObject: SceneComponent)
575
- // {
576
- // if (!LYObject)
577
- // {
578
- // console.error("Controller::registAsClickable : clickable is null", LYObject)
579
- // return
580
- // }
581
-
582
- // let index = this.clickable.indexOf(LYObject)
583
- // if (index >= 0)
584
- // {
585
- // return
586
- // }
587
- // this.clickable.push(LYObject)
588
- // }
589
-
590
- // unregistAsClickable(LYObject: SceneComponent)
591
- // {
592
- // let index = this.clickable.indexOf(LYObject)
593
- // if (index >= 0)
594
- // {
595
- // this.clickable.splice(index, 1)
596
- // }
597
- // }
598
-
599
-
600
- // public getHitResultUnderCursor(objects: SceneComponent[] = [], depth: number = 1)
601
- // {
602
- // if (!this.ray)
603
- // {
604
- // this.ray = new LYRaycaster(this.world)
605
- // }
606
- // if (!this.Camera)
607
- // {
608
- // return []
609
- // }
610
- // this.ray.setFromCamera(this.pointer, this.Camera)
611
- // let retVal = [];
612
- // let realHit = new Set()
613
-
614
- // if(objects.length === 0)
615
- // {
616
- // let arr = new Set(this.clickable.concat(this.hoverable))
617
- // arr.forEach((elem)=>{
618
- // realHit.add(elem.threeObject)
619
- // })
620
- // }
621
- // else
622
- // {
623
- // objects.forEach((obj) =>
624
- // {
625
- // realHit.add(obj.threeObject)
626
- // })
627
- // }
628
-
629
-
630
- // this.blockingMesh.forEach((obj) =>
631
- // {
632
- // realHit.add(obj)
633
- // })
634
- // let traced = this.ray.intersectObjects(Array.from(realHit), false)
635
- // if (traced.length === 0)
636
- // {
637
- // return retVal
638
- // }
639
-
640
- // for (let i = 0; (i < traced.length) && (i < depth); ++i)
641
- // {
642
- // let myObj = traced[i].object.userData["LYObject"]
643
- // if (this.blockingMesh.indexOf(traced[i].object) >= 0)
644
- // {
645
- // return retVal
646
- // }
647
- // if (myObj instanceof SceneComponent)
648
- // {
649
- // retVal.push({
650
- // hitComp: myObj,
651
- // hitInfo: traced[i]
652
- // })
653
- // }
654
- // }
655
- // return retVal
656
- // }
657
-
658
- // public getHitOnScreentPosition(clientX: number, clientY: number, traceObjects: Object3D[])
659
- // {
660
- // if (!this.ray)
661
- // {
662
- // this.ray = new LYRaycaster(this.world)
663
- // }
664
- // let ele = this.world.OuterElement;
665
- // const canvasRect = this.world.Element.getBoundingClientRect();
666
- // const offsetX = canvasRect.left;
667
- // const offsetY = canvasRect.top;
668
- // const pointer = new Vector2(((clientX - offsetX) / ele.clientWidth) * 2 - 1, 1 - ((clientY - offsetY) / ele.clientHeight) * 2)
669
- // this.ray.setFromCamera(pointer, this.Camera)
670
- // let traced = this.ray.intersectObjects(traceObjects, true)
671
- // return traced
672
- // }
673
-
674
- // getTracedResultFromObjects(clientX: number, clientY: number, objects: Object3D[] = this.world?.scene?.children)
675
- // {
676
- // if (!this.ray)
677
- // {
678
- // this.ray = new LYRaycaster(this.world)
679
- // }
680
- // let ele = this.world.OuterElement;
681
- // const canvasRect = this.world.Element.getBoundingClientRect();
682
- // const offsetX = canvasRect.left;
683
- // const offsetY = canvasRect.top;
684
- // const pointer = new Vector2(((clientX - offsetX) / ele.clientWidth) * 2 - 1, 1 - ((clientY - offsetY) / ele.clientHeight) * 2)
685
- // this.ray.setFromCamera(pointer, this.Camera)
686
- // let traced = this.ray.intersectObjects(objects, true)
687
- // return traced
688
- // }
689
-
690
- // lineTrace(origin: Vector3, direction: Vector3, ignoreObjects: Object3D[] | null = null)
691
- // {
692
- // if (!this.ray)
693
- // {
694
- // this.ray = new LYRaycaster(this.world)
695
- // }
696
-
697
- // this.ray.setOriginAndDirection(origin, direction)
698
-
699
- // let traced = this.ray.intersectObjects(this.world.scene?.children, true)
700
- // for (let i = 0; i < traced.length; ++i)
701
- // {
702
- // if (!ignoreObjects || ignoreObjects.length === 0)
703
- // {
704
- // return traced[i]
705
- // }
706
- // if (ignoreObjects.indexOf(traced[i].object) < 0)
707
- // {
708
- // return traced[i]
709
- // }
710
- // }
711
- // return null
712
- // }
713
-
714
- // setViewOffset(offsetX: number, offsetY: number)
715
- // {
716
- // let ele = this.world.OuterElement;
717
- // let w = ele.clientWidth
718
- // let h = ele.clientHeight
719
- // if (this.Camera instanceof PerspectiveCamera)
720
- // {
721
- // this.Camera.setViewOffset(w, h, w * offsetX, h * offsetY, w, h)
722
- // }
723
- // }
724
-
725
- // setViewOffsetX(offsetX: number)
726
- // {
727
- // let ele = this.world.OuterElement;
728
- // let w = ele.clientWidth
729
- // let h = ele.clientHeight
730
- // if (this.Camera instanceof PerspectiveCamera)
731
- // {
732
- // this.Camera.setViewOffset(w, h, w * offsetX, 0, w, h)
733
- // }
734
- // }
735
-
736
- // destroy(): void
737
- // {
738
- // if (this.pawn)
739
- // {
740
- // this.pawn.unpossess();
741
- // this.pawn.destroy();
742
- // this.pawn = null;
743
- // }
744
- // this.resizeObserver.disconnect();
745
- // let ele = this.world.Element
746
- // ele.removeEventListener('mouseenter', this.onPointerEnterFunc);
747
- // ele.removeEventListener("mouseleave", this.onPointerLeaveFunc);
748
-
749
- // this.onMouseLeaveCanvas()
750
-
751
- // this.hoverable = [];
752
- // this.clickable = [];
753
- // this.blockingMesh = []
754
- // this.cameraStat = null;
755
- // this.camera = null;
756
- // this.transformControl = null;
757
- // this.onClickNullEvent = [];
758
-
759
- // this.onMouseEnterDelegate.clear()
760
- // this.onMouseLeaveDelegate.clear()
761
- // this.onMouseMoveDelegate.clear()
762
- // this.onCameraChanged.clear()
763
- // }
764
- // }