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.
- package/dist/bundle.cjs.js +2782 -0
- package/dist/bundle.esm.js +2747 -0
- package/dist/index.d.ts +42 -0
- 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/index.ts +0 -44
- 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,511 +0,0 @@
|
|
|
1
|
-
// import {LYController} from './Object/Controller/Controller';
|
|
2
|
-
// import {Actor} from './Object/Actor';
|
|
3
|
-
|
|
4
|
-
// import {
|
|
5
|
-
// ACESFilmicToneMapping,
|
|
6
|
-
// Clock, FloatType,
|
|
7
|
-
// Mesh,
|
|
8
|
-
// PCFSoftShadowMap,
|
|
9
|
-
// RGBAFormat,
|
|
10
|
-
// Scene,
|
|
11
|
-
// SRGBColorSpace,
|
|
12
|
-
// Vector2,
|
|
13
|
-
// WebGLRenderer,
|
|
14
|
-
// WebGLRenderTarget,
|
|
15
|
-
// } from 'three';
|
|
16
|
-
// import {EffectComposer} from 'three/examples/jsm/postprocessing/EffectComposer';
|
|
17
|
-
// import {Octree} from "three/addons/math/Octree.js";
|
|
18
|
-
// import Stats from "three/addons/libs/stats.module.js";
|
|
19
|
-
// import {LYAssetManager} from "./AssetManagement/AssetManager";
|
|
20
|
-
// import {CSS2DRenderer} from "three/examples/jsm/renderers/CSS2DRenderer";
|
|
21
|
-
|
|
22
|
-
// export class LYThreeApp
|
|
23
|
-
// {
|
|
24
|
-
// public world: LYThreeWorld;
|
|
25
|
-
// private assetManager: LYAssetManager | null
|
|
26
|
-
// constructor(elementName: string, bShowFPS: boolean)
|
|
27
|
-
// {
|
|
28
|
-
// this.world = new LYThreeWorld(this, elementName, bShowFPS);
|
|
29
|
-
// this.assetManager = LYAssetManager.Get()
|
|
30
|
-
// }
|
|
31
|
-
|
|
32
|
-
// get AssetManager(): LYAssetManager| null
|
|
33
|
-
// {
|
|
34
|
-
// return this.assetManager
|
|
35
|
-
// }
|
|
36
|
-
|
|
37
|
-
// get World(): LYThreeWorld
|
|
38
|
-
// {
|
|
39
|
-
// return this.world;
|
|
40
|
-
// }
|
|
41
|
-
|
|
42
|
-
// setTickEnabled(bEnabled: boolean): void
|
|
43
|
-
// {
|
|
44
|
-
// this.world.setTickEnabled(bEnabled);
|
|
45
|
-
// }
|
|
46
|
-
|
|
47
|
-
// destroy()
|
|
48
|
-
// {
|
|
49
|
-
// this.world.destroy()
|
|
50
|
-
// this.world = null
|
|
51
|
-
|
|
52
|
-
// this.AssetManager.clearAssets();
|
|
53
|
-
// this.assetManager = null
|
|
54
|
-
// }
|
|
55
|
-
// }
|
|
56
|
-
|
|
57
|
-
// export class LYThreeWorld
|
|
58
|
-
// {
|
|
59
|
-
|
|
60
|
-
// private _scene: Scene|null;
|
|
61
|
-
// protected objsInWorld: any[];
|
|
62
|
-
// protected elementId: string;
|
|
63
|
-
// protected bTickEnabled: boolean = true;
|
|
64
|
-
// private _renderer: WebGLRenderer | null;
|
|
65
|
-
// protected composer: EffectComposer;
|
|
66
|
-
// protected labelRenderer: CSS2DRenderer | null;
|
|
67
|
-
// protected controller: LYController | null;
|
|
68
|
-
// protected tickFuncs: any[] = [];
|
|
69
|
-
// protected clock: any;
|
|
70
|
-
|
|
71
|
-
// get App(): LYThreeApp
|
|
72
|
-
// {
|
|
73
|
-
// return this._app;
|
|
74
|
-
// }
|
|
75
|
-
// private _app: LYThreeApp;
|
|
76
|
-
|
|
77
|
-
// protected octree: Octree;
|
|
78
|
-
// protected bRenderStateDirty: boolean;
|
|
79
|
-
// protected stats: any;
|
|
80
|
-
// protected octreeHelper: any;
|
|
81
|
-
// protected bShowFPS: boolean = false
|
|
82
|
-
|
|
83
|
-
// private animationFrameHandle : any
|
|
84
|
-
// constructor(app: LYThreeApp, elementId: string, bShowFPS: boolean)
|
|
85
|
-
// {
|
|
86
|
-
// this.bShowFPS = bShowFPS;
|
|
87
|
-
// this._scene = new Scene();
|
|
88
|
-
// // const bgcolor = new Color(0x216c9d);
|
|
89
|
-
// // this.scene.background = bgcolor;
|
|
90
|
-
// // this.scene.fog = new Fog(bgcolor, 50, 300);
|
|
91
|
-
// this.objsInWorld = []
|
|
92
|
-
// this.elementId = elementId
|
|
93
|
-
// this._renderer = new WebGLRenderer({
|
|
94
|
-
// antialias: true,
|
|
95
|
-
// logarithmicDepthBuffer: true,
|
|
96
|
-
// });
|
|
97
|
-
|
|
98
|
-
// let ele = this.OuterElement;
|
|
99
|
-
// this._renderer.setPixelRatio(Math.max(1.1, window.devicePixelRatio));
|
|
100
|
-
// this._renderer.setSize(ele.clientWidth, ele.clientHeight);
|
|
101
|
-
// this._renderer.shadowMap.type = PCFSoftShadowMap
|
|
102
|
-
// this._renderer.shadowMap.enabled = true
|
|
103
|
-
// this._renderer.outputColorSpace = SRGBColorSpace;
|
|
104
|
-
// this._renderer.toneMapping = ACESFilmicToneMapping;
|
|
105
|
-
// this._renderer.domElement.className = 'scene-renderer';
|
|
106
|
-
// document.getElementById(elementId).appendChild(this._renderer.domElement)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
// this.labelRenderer = new CSS2DRenderer();
|
|
110
|
-
// this.labelRenderer.setSize(ele.clientWidth, ele.clientHeight);
|
|
111
|
-
// this.labelRenderer.domElement.style.pointerEvents = 'none';
|
|
112
|
-
// this.labelRenderer.domElement.style.position = 'absolute';
|
|
113
|
-
// this.labelRenderer.domElement.style.top = '0px';
|
|
114
|
-
// this.labelRenderer.domElement.className = 'scene-labelRenderer';
|
|
115
|
-
// document.getElementById(elementId).appendChild(this.labelRenderer.domElement)
|
|
116
|
-
|
|
117
|
-
// let instance = this;
|
|
118
|
-
// this.controller = new LYController(instance);
|
|
119
|
-
// this.controller.init()
|
|
120
|
-
|
|
121
|
-
// this.clock = new Clock();
|
|
122
|
-
// this._app = app;
|
|
123
|
-
|
|
124
|
-
// this.octree = null
|
|
125
|
-
// this.bRenderStateDirty = false
|
|
126
|
-
|
|
127
|
-
// this.composer = null
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
// if (this.bShowFPS)
|
|
131
|
-
// {
|
|
132
|
-
// console.log("create fps")
|
|
133
|
-
// // 创建性能监视器
|
|
134
|
-
// this.stats = new Stats()
|
|
135
|
-
|
|
136
|
-
// // 设置监视器面板,传入面板id(0: fps, 1: ms, 2: mb)
|
|
137
|
-
// this.stats.setMode(0)
|
|
138
|
-
|
|
139
|
-
// // 设置监视器位置
|
|
140
|
-
// this.stats.domElement.style.position = 'absolute'
|
|
141
|
-
// this.stats.domElement.style.left = '90%'
|
|
142
|
-
// this.stats.domElement.style.top = '90%'
|
|
143
|
-
// this.stats.domElement.className = 'stats'
|
|
144
|
-
|
|
145
|
-
// // 将监视器添加到页面中
|
|
146
|
-
// ele.appendChild(this.stats.domElement)
|
|
147
|
-
// }
|
|
148
|
-
// this.Controller?.onCameraChanged.add(()=>{
|
|
149
|
-
// if(!this.composer )
|
|
150
|
-
// {
|
|
151
|
-
// return
|
|
152
|
-
// }
|
|
153
|
-
// if(!this.Controller?.Camera)
|
|
154
|
-
// {
|
|
155
|
-
// return
|
|
156
|
-
// }
|
|
157
|
-
|
|
158
|
-
// for(let i in this.composer.passes)
|
|
159
|
-
// {
|
|
160
|
-
// const pass = this.composer.passes[i]
|
|
161
|
-
// if(pass.hasOwnProperty("camera"))
|
|
162
|
-
// {
|
|
163
|
-
// pass["camera"] = this.Controller.Camera
|
|
164
|
-
// continue
|
|
165
|
-
// }
|
|
166
|
-
// if(pass.hasOwnProperty("renderCamera"))
|
|
167
|
-
// {
|
|
168
|
-
// pass["renderCamera"] = this.Controller.Camera
|
|
169
|
-
// continue
|
|
170
|
-
// }
|
|
171
|
-
|
|
172
|
-
// }
|
|
173
|
-
// })
|
|
174
|
-
|
|
175
|
-
// this.tick();
|
|
176
|
-
// }
|
|
177
|
-
|
|
178
|
-
// get AssetManager(): LYAssetManager| null
|
|
179
|
-
// {
|
|
180
|
-
// return this._app.AssetManager;
|
|
181
|
-
// }
|
|
182
|
-
|
|
183
|
-
// get scene()
|
|
184
|
-
// {
|
|
185
|
-
// return this._scene;
|
|
186
|
-
// }
|
|
187
|
-
|
|
188
|
-
// setTickEnabled(bEnabled = true)
|
|
189
|
-
// {
|
|
190
|
-
// if(!this.bTickEnabled && bEnabled)
|
|
191
|
-
// {
|
|
192
|
-
// this.bTickEnabled = true
|
|
193
|
-
// this.tick()
|
|
194
|
-
// return;
|
|
195
|
-
// }
|
|
196
|
-
// this.bTickEnabled = bEnabled
|
|
197
|
-
// }
|
|
198
|
-
|
|
199
|
-
// get renderer(): WebGLRenderer|null
|
|
200
|
-
// {
|
|
201
|
-
// return this._renderer;
|
|
202
|
-
// }
|
|
203
|
-
|
|
204
|
-
// setLocalClippingEnabled(bEnabled:boolean)
|
|
205
|
-
// {
|
|
206
|
-
// if(!this.renderer)
|
|
207
|
-
// {
|
|
208
|
-
// return
|
|
209
|
-
// }
|
|
210
|
-
// if(bEnabled)
|
|
211
|
-
// {
|
|
212
|
-
// this.renderer.clippingPlanes = Object.freeze( [] );
|
|
213
|
-
// this.renderer.localClippingEnabled = true;
|
|
214
|
-
// }
|
|
215
|
-
// else
|
|
216
|
-
// {
|
|
217
|
-
// this.renderer.localClippingEnabled = false;
|
|
218
|
-
// }
|
|
219
|
-
// }
|
|
220
|
-
|
|
221
|
-
// get Element()
|
|
222
|
-
// {
|
|
223
|
-
// return this._renderer.domElement
|
|
224
|
-
// }
|
|
225
|
-
|
|
226
|
-
// get OuterElement()
|
|
227
|
-
// {
|
|
228
|
-
// return document.getElementById(this.elementId);
|
|
229
|
-
// }
|
|
230
|
-
|
|
231
|
-
// get Controller()
|
|
232
|
-
// {
|
|
233
|
-
// return this.controller;
|
|
234
|
-
// }
|
|
235
|
-
|
|
236
|
-
// get Composer()
|
|
237
|
-
// {
|
|
238
|
-
// return this.composer;
|
|
239
|
-
// }
|
|
240
|
-
|
|
241
|
-
// createComposer()
|
|
242
|
-
// {
|
|
243
|
-
// if(this.composer)
|
|
244
|
-
// {
|
|
245
|
-
// return
|
|
246
|
-
// }
|
|
247
|
-
// const renderer = this._renderer
|
|
248
|
-
// if(!renderer)
|
|
249
|
-
// {
|
|
250
|
-
// return
|
|
251
|
-
// }
|
|
252
|
-
// //添加后期渲染
|
|
253
|
-
// let size = new Vector2()
|
|
254
|
-
// renderer.getDrawingBufferSize(size)
|
|
255
|
-
// const renderTarget = new WebGLRenderTarget(size.width, size.height, {
|
|
256
|
-
// samples : 32,
|
|
257
|
-
// format : RGBAFormat,
|
|
258
|
-
// type : FloatType,
|
|
259
|
-
// colorSpace: SRGBColorSpace
|
|
260
|
-
// }
|
|
261
|
-
// )
|
|
262
|
-
// this.composer = new EffectComposer(renderer, renderTarget);
|
|
263
|
-
// let ele = this.OuterElement;
|
|
264
|
-
// this.composer.setPixelRatio(Math.max(1.1, window.devicePixelRatio));
|
|
265
|
-
// this.composer.setSize(ele.clientWidth, ele.clientHeight);
|
|
266
|
-
// }
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
// // onCameraChanged(newCamera)
|
|
270
|
-
// // {
|
|
271
|
-
// // if (!this.composer)
|
|
272
|
-
// // {
|
|
273
|
-
// // return;
|
|
274
|
-
// // }
|
|
275
|
-
// //
|
|
276
|
-
// // this.composer.passes.forEach((pass) =>
|
|
277
|
-
// // {
|
|
278
|
-
// // pass.camera = newCamera;
|
|
279
|
-
// // })
|
|
280
|
-
// // }
|
|
281
|
-
|
|
282
|
-
// buildOctree(group)
|
|
283
|
-
// {
|
|
284
|
-
// if (this.octreeHelper)
|
|
285
|
-
// {
|
|
286
|
-
// this._scene.remove(this.octreeHelper)
|
|
287
|
-
// this.octreeHelper = null
|
|
288
|
-
// }
|
|
289
|
-
// this.octree = new Octree();
|
|
290
|
-
// if (group)
|
|
291
|
-
// {
|
|
292
|
-
// this.octree.fromGraphNode(group)
|
|
293
|
-
// }
|
|
294
|
-
// // this.#octreeHelper = new OctreeHelper( this.#octree );
|
|
295
|
-
// // this.scene.add( this.#octreeHelper );
|
|
296
|
-
// this.markRenderStateDirty();
|
|
297
|
-
// }
|
|
298
|
-
|
|
299
|
-
// get Octree()
|
|
300
|
-
// {
|
|
301
|
-
// return this.octree
|
|
302
|
-
// }
|
|
303
|
-
|
|
304
|
-
// addActor(Obj:Actor)
|
|
305
|
-
// {
|
|
306
|
-
// if (Obj instanceof Actor)
|
|
307
|
-
// {
|
|
308
|
-
// this.objsInWorld.push(Obj)
|
|
309
|
-
// this.scene.add(Obj.RootComponent.threeObject)
|
|
310
|
-
// Obj.onAddedToWorld(this);
|
|
311
|
-
// this.markRenderStateDirty();
|
|
312
|
-
// } else
|
|
313
|
-
// {
|
|
314
|
-
// console.log("Trying to add obj in scene whitch is not a LYBaseActor");
|
|
315
|
-
// console.log(Obj)
|
|
316
|
-
// }
|
|
317
|
-
// }
|
|
318
|
-
|
|
319
|
-
// removeActor(Obj)
|
|
320
|
-
// {
|
|
321
|
-
// if (Obj instanceof Actor)
|
|
322
|
-
// {
|
|
323
|
-
// let index = this.objsInWorld.indexOf(Obj);
|
|
324
|
-
// if (index !== -1)
|
|
325
|
-
// {
|
|
326
|
-
// this.objsInWorld.splice(index, 1);
|
|
327
|
-
// }
|
|
328
|
-
|
|
329
|
-
// Obj.onRemovedFromWorld();
|
|
330
|
-
// } else
|
|
331
|
-
// {
|
|
332
|
-
// console.log("Trying to remove obj from scene whitch is not a LYBaseActor");
|
|
333
|
-
// }
|
|
334
|
-
// }
|
|
335
|
-
|
|
336
|
-
// getSceneObjectCount()
|
|
337
|
-
// {
|
|
338
|
-
|
|
339
|
-
// }
|
|
340
|
-
|
|
341
|
-
// markRenderStateDirty()
|
|
342
|
-
// {
|
|
343
|
-
// this.bRenderStateDirty = true;
|
|
344
|
-
// }
|
|
345
|
-
|
|
346
|
-
// /* Should not be called directly*/
|
|
347
|
-
// getObjChildren(obj, layer = 0)
|
|
348
|
-
// {
|
|
349
|
-
// if (obj.isObject3D)
|
|
350
|
-
// {
|
|
351
|
-
// let space = ''
|
|
352
|
-
// for (let i = 0; i < layer; ++i)
|
|
353
|
-
// {
|
|
354
|
-
// space += ' '
|
|
355
|
-
// }
|
|
356
|
-
|
|
357
|
-
// if (obj.children.length > 0)
|
|
358
|
-
// {
|
|
359
|
-
|
|
360
|
-
// for (let index in obj.children)
|
|
361
|
-
// {
|
|
362
|
-
// this.getObjChildren(obj.children[index], layer + 1);
|
|
363
|
-
// }
|
|
364
|
-
// }
|
|
365
|
-
// }
|
|
366
|
-
|
|
367
|
-
// }
|
|
368
|
-
|
|
369
|
-
// getObjsInWorld()
|
|
370
|
-
// {
|
|
371
|
-
// return this.objsInWorld
|
|
372
|
-
// }
|
|
373
|
-
|
|
374
|
-
// tick()
|
|
375
|
-
// {
|
|
376
|
-
// let instance = this;
|
|
377
|
-
|
|
378
|
-
// if (!this.bTickEnabled) {
|
|
379
|
-
// return;
|
|
380
|
-
// }
|
|
381
|
-
// // tick logic
|
|
382
|
-
// const delta = this.clock.getDelta() // 获取自上次调用的时间
|
|
383
|
-
|
|
384
|
-
// for (let i = 0; i < this.objsInWorld.length; ++i)
|
|
385
|
-
// {
|
|
386
|
-
// this.objsInWorld[i].tick(delta)
|
|
387
|
-
// }
|
|
388
|
-
|
|
389
|
-
// for (let i = 0; i < this.tickFuncs.length; ++i)
|
|
390
|
-
// {
|
|
391
|
-
// this.tickFuncs[i](delta)
|
|
392
|
-
// }
|
|
393
|
-
// this.Controller.tick(delta)
|
|
394
|
-
// // tick render
|
|
395
|
-
// if (this.bRenderStateDirty)
|
|
396
|
-
// {
|
|
397
|
-
// if(this.controller.Camera)
|
|
398
|
-
// {
|
|
399
|
-
// this.labelRenderer.render(this._scene, this.controller.Camera);
|
|
400
|
-
|
|
401
|
-
// if (this.composer)
|
|
402
|
-
// {
|
|
403
|
-
// this.composer.render(delta);
|
|
404
|
-
// }
|
|
405
|
-
// else
|
|
406
|
-
// {
|
|
407
|
-
// this._renderer.render(this._scene, this.controller.Camera);
|
|
408
|
-
// }
|
|
409
|
-
// this.bRenderStateDirty = false
|
|
410
|
-
// }
|
|
411
|
-
// }
|
|
412
|
-
|
|
413
|
-
// if (this.stats)
|
|
414
|
-
// {
|
|
415
|
-
// this.stats.update()
|
|
416
|
-
// }
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
// this.animationFrameHandle = window.requestAnimationFrame(
|
|
420
|
-
// () =>
|
|
421
|
-
// {
|
|
422
|
-
// instance.tick();
|
|
423
|
-
// }
|
|
424
|
-
// );
|
|
425
|
-
// }
|
|
426
|
-
|
|
427
|
-
// onLoadGLTFFinished(loadedActor, levelName)
|
|
428
|
-
// {
|
|
429
|
-
|
|
430
|
-
// }
|
|
431
|
-
|
|
432
|
-
// postProcess()
|
|
433
|
-
// {
|
|
434
|
-
|
|
435
|
-
// }
|
|
436
|
-
|
|
437
|
-
// addTickFunc(newFunc)
|
|
438
|
-
// {
|
|
439
|
-
// let index = this.tickFuncs.indexOf(newFunc)
|
|
440
|
-
// if (index >= 0)
|
|
441
|
-
// {
|
|
442
|
-
// return
|
|
443
|
-
// }
|
|
444
|
-
// this.tickFuncs.push(newFunc);
|
|
445
|
-
// }
|
|
446
|
-
|
|
447
|
-
// removeTickFunc(target)
|
|
448
|
-
// {
|
|
449
|
-
// let index = this.tickFuncs.indexOf(target)
|
|
450
|
-
// if (index >= 0)
|
|
451
|
-
// {
|
|
452
|
-
// this.tickFuncs.splice(index, 1)
|
|
453
|
-
// }
|
|
454
|
-
// }
|
|
455
|
-
|
|
456
|
-
// destroy()
|
|
457
|
-
// {
|
|
458
|
-
// console.log("World is destroying")
|
|
459
|
-
// this.tickFuncs = []
|
|
460
|
-
// window.cancelAnimationFrame(this.animationFrameHandle)
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
// this._scene?.traverse((elem) =>
|
|
464
|
-
// {
|
|
465
|
-
// if (elem instanceof Mesh)
|
|
466
|
-
// {
|
|
467
|
-
// if (elem.material)
|
|
468
|
-
// {
|
|
469
|
-
// let arr = elem.material instanceof Array ? elem.material : [elem.material]
|
|
470
|
-
|
|
471
|
-
// arr.forEach((mat) =>
|
|
472
|
-
// {
|
|
473
|
-
// mat.dispose()
|
|
474
|
-
// mat = null
|
|
475
|
-
// })
|
|
476
|
-
// }
|
|
477
|
-
// if (elem.geometry)
|
|
478
|
-
// {
|
|
479
|
-
// elem.geometry.dispose()
|
|
480
|
-
|
|
481
|
-
// }
|
|
482
|
-
// }
|
|
483
|
-
// })
|
|
484
|
-
// // for (let i in this.objsInWorld)
|
|
485
|
-
// // {
|
|
486
|
-
// // this.objsInWorld[i].destroy();
|
|
487
|
-
// // }
|
|
488
|
-
// //
|
|
489
|
-
// this._scene.clear()
|
|
490
|
-
// this._scene = null
|
|
491
|
-
// this.controller?.destroy()
|
|
492
|
-
// this.controller = null;
|
|
493
|
-
|
|
494
|
-
// this._renderer.forceContextLoss();
|
|
495
|
-
// this._renderer.context = null;
|
|
496
|
-
// this._renderer.domElement = null;
|
|
497
|
-
// this._renderer.dispose()
|
|
498
|
-
|
|
499
|
-
// this.labelRenderer.context = null;
|
|
500
|
-
// this.labelRenderer.domElement = null;
|
|
501
|
-
// this.labelRenderer = null;
|
|
502
|
-
// this.composer?.dispose()
|
|
503
|
-
// this.composer = null;
|
|
504
|
-
// }
|
|
505
|
-
|
|
506
|
-
// renderAsImage() {
|
|
507
|
-
// let image = new Image();
|
|
508
|
-
// this.renderer.render(this._scene, this.controller.Camera); //此处renderer为three.js里的渲染器,scene为场景 camera为相机
|
|
509
|
-
// return this.renderer.domElement.toDataURL('image/jpeg');
|
|
510
|
-
// }
|
|
511
|
-
// }
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// 创建顶点位置数组
|
|
2
|
-
import {
|
|
3
|
-
BufferAttribute,
|
|
4
|
-
BufferGeometry,
|
|
5
|
-
Float32BufferAttribute,
|
|
6
|
-
Uint16BufferAttribute,
|
|
7
|
-
} from 'three';
|
|
8
|
-
|
|
9
|
-
function createPlaneGeometryFaceUp():BufferGeometry
|
|
10
|
-
{
|
|
11
|
-
const vertices = [
|
|
12
|
-
-0.5,
|
|
13
|
-
0,
|
|
14
|
-
-0.5, // 顶点1
|
|
15
|
-
0.5,
|
|
16
|
-
0,
|
|
17
|
-
-0.5, // 顶点2
|
|
18
|
-
0.5,
|
|
19
|
-
0,
|
|
20
|
-
0.5, // 顶点3
|
|
21
|
-
-0.5,
|
|
22
|
-
0,
|
|
23
|
-
0.5, // 顶点4
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
// 创建法线数组,所有法线都朝向Y轴正方向
|
|
27
|
-
const normals = [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0];
|
|
28
|
-
|
|
29
|
-
// 创建索引数组,用于确定顶点如何连接成三角形
|
|
30
|
-
const indices = [0, 2, 1, 2, 0, 3];
|
|
31
|
-
const uvs = new Float32Array([
|
|
32
|
-
0,
|
|
33
|
-
0, //图片左下角
|
|
34
|
-
1,
|
|
35
|
-
0, //图片右下角
|
|
36
|
-
1,
|
|
37
|
-
1, //图片右上角
|
|
38
|
-
0,
|
|
39
|
-
1, //图片左上角
|
|
40
|
-
]);
|
|
41
|
-
// 创建BufferPlaneGeometryFaceUp
|
|
42
|
-
const PlaneGeometryFaceUp = new BufferGeometry();
|
|
43
|
-
const positionAttribute = new Float32BufferAttribute(vertices, 3);
|
|
44
|
-
const normalAttribute = new Float32BufferAttribute(normals, 3);
|
|
45
|
-
const indexAttribute = new Uint16BufferAttribute(indices, 1);
|
|
46
|
-
PlaneGeometryFaceUp.attributes.uv = new BufferAttribute(uvs, 2);
|
|
47
|
-
PlaneGeometryFaceUp.setAttribute('position', positionAttribute);
|
|
48
|
-
PlaneGeometryFaceUp.setAttribute('normal', normalAttribute);
|
|
49
|
-
PlaneGeometryFaceUp.setIndex(indexAttribute);
|
|
50
|
-
return PlaneGeometryFaceUp
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { createPlaneGeometryFaceUp };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// 创建顶点位置数组
|
|
2
|
-
import {
|
|
3
|
-
BufferAttribute,
|
|
4
|
-
BufferGeometry,
|
|
5
|
-
Float32BufferAttribute,
|
|
6
|
-
Uint16BufferAttribute,
|
|
7
|
-
} from 'three';
|
|
8
|
-
|
|
9
|
-
function createArrowHeadGeometry():BufferGeometry
|
|
10
|
-
{
|
|
11
|
-
const vertices = [
|
|
12
|
-
-0.5,
|
|
13
|
-
0,
|
|
14
|
-
0, // 顶点1
|
|
15
|
-
0,
|
|
16
|
-
0,
|
|
17
|
-
0.5, // 顶点2
|
|
18
|
-
0.5,
|
|
19
|
-
0,
|
|
20
|
-
0, // 顶点3
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
// 创建法线数组,所有法线都朝向Y轴正方向
|
|
24
|
-
const normals = [0, 1, 0, 0, 1, 0, 0, 1, 0];
|
|
25
|
-
|
|
26
|
-
// 创建索引数组,用于确定顶点如何连接成三角形
|
|
27
|
-
const indices = [0, 1, 2];
|
|
28
|
-
const uvs = new Float32Array([
|
|
29
|
-
0,
|
|
30
|
-
0, //图片左下角
|
|
31
|
-
1,
|
|
32
|
-
0, //图片右下角
|
|
33
|
-
1,
|
|
34
|
-
1, //图片右上角
|
|
35
|
-
0,
|
|
36
|
-
1, //图片左上角
|
|
37
|
-
]);
|
|
38
|
-
// 创建BufferPlaneGeometryFaceUp
|
|
39
|
-
const PlaneGeometryFaceUp = new BufferGeometry();
|
|
40
|
-
const positionAttribute = new Float32BufferAttribute(vertices, 3);
|
|
41
|
-
const normalAttribute = new Float32BufferAttribute(normals, 3);
|
|
42
|
-
const indexAttribute = new Uint16BufferAttribute(indices, 1);
|
|
43
|
-
PlaneGeometryFaceUp.attributes.uv = new BufferAttribute(uvs, 2);
|
|
44
|
-
PlaneGeometryFaceUp.setAttribute('position', positionAttribute);
|
|
45
|
-
PlaneGeometryFaceUp.setAttribute('normal', normalAttribute);
|
|
46
|
-
PlaneGeometryFaceUp.setIndex(indexAttribute);
|
|
47
|
-
return PlaneGeometryFaceUp
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export { createArrowHeadGeometry };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export class LYContainerLibrary
|
|
2
|
-
{
|
|
3
|
-
static AreUnorderedArrayEqual(arr1: any[], arr2: any[]): boolean {
|
|
4
|
-
// 首先检查数组长度是否相同
|
|
5
|
-
if (arr1.length !== arr2.length) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// 对两个数组进行排序,然后比较每一个元素
|
|
10
|
-
const sortedArr1 = [...arr1].sort();
|
|
11
|
-
const sortedArr2 = [...arr2].sort();
|
|
12
|
-
|
|
13
|
-
for (let i = 0; i < sortedArr1.length; i++) {
|
|
14
|
-
if (sortedArr1[i] !== sortedArr2[i]) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
}
|