lythreeframe 1.0.2 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/README.md +3 -0
- package/dist/index.ts +80 -0
- package/package.json +18 -12
- package/rollup.config.js +31 -0
- package/src/draco/README.md +32 -0
- package/src/draco/draco_decoder.js +34 -0
- package/src/draco/draco_decoder.wasm +0 -0
- package/src/draco/draco_encoder.js +33 -0
- package/src/draco/draco_wasm_wrapper.js +117 -0
- package/src/draco/gltf/draco_decoder.js +33 -0
- package/src/draco/gltf/draco_decoder.wasm +0 -0
- package/src/draco/gltf/draco_encoder.js +33 -0
- package/src/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/src/index.ts +44 -0
- package/src/{AssetManagement → lythreeframe/AssetManagement}/AssetManager.ts +8 -6
- package/src/{AssetManagement → lythreeframe/AssetManagement}/AssetPointer/AssetPointer.ts +1 -1
- package/src/{Frame → lythreeframe/Frame}/Controller.ts +7 -7
- package/src/{Frame → lythreeframe/Frame}/Viewport.ts +58 -58
- package/src/{Frame → lythreeframe/Frame}/World.ts +4 -4
- package/src/{Frame.ts → lythreeframe/Frame.ts} +1 -1
- package/src/lythreeframe/Library/MaterialLibrary.ts +292 -0
- package/src/{Library → lythreeframe/Library}/Math.ts +4 -4
- package/src/{Object → lythreeframe/Object}/Actor.ts +2 -2
- package/src/{Object → lythreeframe/Object}/Actors/Camera/CameraActor.ts +1 -1
- package/src/{Object → lythreeframe/Object}/Actors/Light/DirectionalLightActor.ts +2 -2
- package/src/{Object → lythreeframe/Object}/Actors/Shape/BoxActor.ts +2 -2
- package/src/{Object → lythreeframe/Object}/Actors/Shape/PlaneActor.ts +2 -2
- package/src/lythreeframe/Object/Actors/Shape/TubeActor.ts +37 -0
- package/src/{Object → lythreeframe/Object}/Components/2D/2DComponent.ts +1 -1
- package/src/{Object → lythreeframe/Object}/Components/Camera/CameraComponent.ts +1 -1
- package/src/{Object → lythreeframe/Object}/Components/Component.ts +1 -1
- package/src/{Object → lythreeframe/Object}/Components/Light/LightComponent.ts +1 -1
- package/src/{Object → lythreeframe/Object}/Components/Mesh/InstanceMesh/MultiInstanceMeshComponent.ts +2 -2
- package/src/{Object → lythreeframe/Object}/Components/Mesh/MeshComponent.ts +2 -2
- package/src/{Object → lythreeframe/Object}/Components/Mesh/Sprite/SpriteComponent.ts +1 -1
- package/src/{Object → lythreeframe/Object}/Components/SceneComponent.ts +10 -8
- package/src/{Object → lythreeframe/Object}/Controller/Controller.ts +2 -2
- package/src/{Object → lythreeframe/Object}/Pawn/CameraStatus.ts +1 -1
- package/src/lythreeframe/Object/Pawn/FirstPerson.ts +230 -0
- package/src/lythreeframe/Object/Pawn/Oribital.ts +276 -0
- package/src/lythreeframe/Object/Pawn/PawnBase.ts +189 -0
- package/src/lythreeframe/Object/Pawn/TopView.ts +205 -0
- package/src/lythreeframe/Object/Pawn/TransformControl.ts +215 -0
- package/src/lythreeframe/Object/Pawn/staticCamera.ts +80 -0
- package/src/{Object → lythreeframe/Object}/PawnV2/FirstPerson.ts +3 -3
- package/src/{Object → lythreeframe/Object}/PawnV2/Oribital.ts +2 -2
- package/src/{Object → lythreeframe/Object}/PawnV2/Pawn.ts +1 -1
- package/src/{Object → lythreeframe/Object}/PawnV2/TransformControl.ts +6 -5
- package/src/{PostProcess → lythreeframe/PostProcess}/Param/DOF.ts +1 -2
- package/src/{PostProcess → lythreeframe/PostProcess}/PostProcessParam.ts +5 -5
- package/src/{ThreeJsApp.ts → lythreeframe/ThreeJsApp.ts} +4 -4
- package/tsconfig.json +105 -0
- package/index.js +0 -48
- package/src/Library/MaterialLibrary.ts +0 -288
- package/src/Object/Actors/Shape/TubeActor.ts +0 -37
- package/src/Object/Pawn/FirstPerson.ts +0 -230
- package/src/Object/Pawn/Oribital.ts +0 -276
- package/src/Object/Pawn/PawnBase.ts +0 -189
- package/src/Object/Pawn/TopView.ts +0 -205
- package/src/Object/Pawn/TransformControl.ts +0 -215
- package/src/Object/Pawn/staticCamera.ts +0 -80
- /package/src/{AssetManagement → lythreeframe/AssetManagement}/AssetDefines.ts +0 -0
- /package/src/{AssetManagement → lythreeframe/AssetManagement}/Task/Task.ts +0 -0
- /package/src/{Container → lythreeframe/Container}/SmartPointer.ts +0 -0
- /package/src/{Defines.ts → lythreeframe/Defines.ts} +0 -0
- /package/src/{Delegate.ts → lythreeframe/Delegate.ts} +0 -0
- /package/src/{Factory → lythreeframe/Factory}/CameraFactory.ts +0 -0
- /package/src/{Factory → lythreeframe/Factory}/RendererFactory.ts +0 -0
- /package/src/{Geometry → lythreeframe/Geometry}/PlaneGeometry.ts +0 -0
- /package/src/{Geometry → lythreeframe/Geometry}/TriangleGeometry.ts +0 -0
- /package/src/{Library → lythreeframe/Library}/ContainerLibrary.ts +0 -0
- /package/src/{Library → lythreeframe/Library}/ResourceLibrary.ts +0 -0
- /package/src/{Object → lythreeframe/Object}/Actors/Shape/CurveActor.ts +0 -0
- /package/src/{Object → lythreeframe/Object}/BaseObject.ts +0 -0
- /package/src/{Object → lythreeframe/Object}/Components/Light/DirectionalLight/DirectionalLightComponent.ts +0 -0
- /package/src/{Object → lythreeframe/Object}/Components/Mesh/InstanceMesh/InstanceMeshComponent.ts +0 -0
- /package/src/{Object → lythreeframe/Object}/Components/Mesh/Line/CurveComponent.ts +0 -0
- /package/src/{Object → lythreeframe/Object}/Components/Mesh/Shape/BoxComponent.ts +0 -0
- /package/src/{Object → lythreeframe/Object}/Components/Mesh/Shape/PlaneComponent.ts +0 -0
- /package/src/{Object → lythreeframe/Object}/Components/Mesh/Shape/SphereComponent.ts +0 -0
- /package/src/{PostProcess → lythreeframe/PostProcess}/Param/Bloom.ts +0 -0
- /package/src/{PostProcess → lythreeframe/PostProcess}/Param/Denoise.ts +0 -0
- /package/src/{PostProcess → lythreeframe/PostProcess}/Param/GTAO.ts +0 -0
- /package/src/{PostProcess → lythreeframe/PostProcess}/Param/LensFlare.ts +0 -0
- /package/src/{PostProcess → lythreeframe/PostProcess}/Param/MotionBlur.ts +0 -0
- /package/src/{PostProcess → lythreeframe/PostProcess}/Param/Outline.ts +0 -0
- /package/src/{PostProcess → lythreeframe/PostProcess}/Param/SSR.ts +0 -0
- /package/src/{PostProcess → lythreeframe/PostProcess}/Param/ToneMapping.ts +0 -0
- /package/src/{PostProcess → lythreeframe/PostProcess}/WebGPUPostProcessFactory.ts +0 -0
- /package/src/{Shader → lythreeframe/Shader}/Postprocess/ColorShader.ts +0 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
// import {
|
|
2
|
+
// AdditiveBlending,
|
|
3
|
+
// Color, CustomBlending,
|
|
4
|
+
// Material,
|
|
5
|
+
// MeshStandardMaterial,
|
|
6
|
+
// MultiplyBlending,
|
|
7
|
+
// NoBlending,
|
|
8
|
+
// NormalBlending,
|
|
9
|
+
// RepeatWrapping,
|
|
10
|
+
|
|
11
|
+
// SubtractiveBlending,
|
|
12
|
+
// Texture,
|
|
13
|
+
// TextureLoader,
|
|
14
|
+
// Vector2
|
|
15
|
+
// } from "three";
|
|
16
|
+
// import {LYThreeWorld} from "@/script/scene/LYCustomFrame/src/Frame";
|
|
17
|
+
// import {Blending} from "three/src/constants";
|
|
18
|
+
// import {AssetType} from "../AssetManagement/AssetDefines";
|
|
19
|
+
|
|
20
|
+
// export class LYMaterialLibrary
|
|
21
|
+
// {
|
|
22
|
+
// static Deserialize(data, world: LYThreeWorld, onFinished:Function = ()=>{})
|
|
23
|
+
// {
|
|
24
|
+
// let mat = new MeshStandardMaterial();
|
|
25
|
+
// LYMaterialLibrary.UpdateMatererialByData(data, mat, world, onFinished)
|
|
26
|
+
// return mat
|
|
27
|
+
// }
|
|
28
|
+
|
|
29
|
+
// static UpdateMatererialByData(data, mat: MeshStandardMaterial, world: LYThreeWorld, onFinished:Function = ()=>{})
|
|
30
|
+
// {
|
|
31
|
+
// let params = data;
|
|
32
|
+
// // color
|
|
33
|
+
// if (params.color)
|
|
34
|
+
// {
|
|
35
|
+
// mat.color = new Color(params.color)
|
|
36
|
+
// }
|
|
37
|
+
// // roughness
|
|
38
|
+
// if (params.roughness)
|
|
39
|
+
// {
|
|
40
|
+
// mat.roughness = params.roughness;
|
|
41
|
+
// }
|
|
42
|
+
// // metalness
|
|
43
|
+
// if (params.metalness)
|
|
44
|
+
// {
|
|
45
|
+
// mat.metalness = params.metalness;
|
|
46
|
+
// }
|
|
47
|
+
// // side
|
|
48
|
+
// if (params.side)
|
|
49
|
+
// {
|
|
50
|
+
// mat.side = params.side;
|
|
51
|
+
// }
|
|
52
|
+
// // blending
|
|
53
|
+
// function toBlendingType(value) {
|
|
54
|
+
// switch (value) {
|
|
55
|
+
// case 0:
|
|
56
|
+
// return NoBlending;
|
|
57
|
+
// case 1:
|
|
58
|
+
// return NormalBlending;
|
|
59
|
+
// case 2:
|
|
60
|
+
// return AdditiveBlending;
|
|
61
|
+
// case 3:
|
|
62
|
+
// return SubtractiveBlending;
|
|
63
|
+
// case 4:
|
|
64
|
+
// return MultiplyBlending;
|
|
65
|
+
// case 5:
|
|
66
|
+
// return CustomBlending;
|
|
67
|
+
// default:
|
|
68
|
+
// console.log("no blending type matched")
|
|
69
|
+
// return NormalBlending; // 默认值或其他错误处理
|
|
70
|
+
// }
|
|
71
|
+
// }
|
|
72
|
+
// if (params.blending)
|
|
73
|
+
// {
|
|
74
|
+
// mat.blending = toBlendingType(Number.parseInt(params.blending))
|
|
75
|
+
// }
|
|
76
|
+
// // opacity
|
|
77
|
+
// if (params.opacity)
|
|
78
|
+
// {
|
|
79
|
+
// mat.opacity = params.opacity;
|
|
80
|
+
// }
|
|
81
|
+
// // transparent
|
|
82
|
+
// mat.transparent = params.transparent ? true : false;
|
|
83
|
+
// // depthTest
|
|
84
|
+
// // mat.depthTest = params.depthTest === false ? false : true;
|
|
85
|
+
// // // depthWrite
|
|
86
|
+
// // mat.depthWrite = params.depthWrite === false ? false : true;
|
|
87
|
+
|
|
88
|
+
// // depthTest7
|
|
89
|
+
// mat.depthTest = true;
|
|
90
|
+
// // depthWrite
|
|
91
|
+
// mat.depthWrite = true;
|
|
92
|
+
// // wireframe
|
|
93
|
+
// mat.wireframe = params.wireframe ? true : false;
|
|
94
|
+
// if(params.name)
|
|
95
|
+
// {
|
|
96
|
+
// mat.name = params.name
|
|
97
|
+
// }
|
|
98
|
+
// let processCount = 0
|
|
99
|
+
// let onTextureLoaded = ()=>{}
|
|
100
|
+
// if(onFinished)
|
|
101
|
+
// {
|
|
102
|
+
// onTextureLoaded = ()=>{
|
|
103
|
+
// processCount--
|
|
104
|
+
// if(processCount===0)
|
|
105
|
+
// {
|
|
106
|
+
// console.log("onfin")
|
|
107
|
+
// onFinished()
|
|
108
|
+
// }
|
|
109
|
+
// }
|
|
110
|
+
// }
|
|
111
|
+
|
|
112
|
+
// // map
|
|
113
|
+
// if (params.map)
|
|
114
|
+
// {
|
|
115
|
+
// processCount++
|
|
116
|
+
// LYMaterialLibrary.loadTexture("map", mat, world, params.map, onTextureLoaded)
|
|
117
|
+
// }
|
|
118
|
+
|
|
119
|
+
// // emissiveMap
|
|
120
|
+
// if (params.emissiveMap)
|
|
121
|
+
// {
|
|
122
|
+
// processCount++
|
|
123
|
+
// LYMaterialLibrary.loadTexture("emissiveMap", mat, world, params.emissiveMap, onTextureLoaded)
|
|
124
|
+
// }
|
|
125
|
+
|
|
126
|
+
// // bump map
|
|
127
|
+
// if (params.alphaMap)
|
|
128
|
+
// {
|
|
129
|
+
// processCount++
|
|
130
|
+
// LYMaterialLibrary.loadTexture("alphaMap", mat, world, params.alphaMap, onTextureLoaded)
|
|
131
|
+
// }
|
|
132
|
+
// // normalMap
|
|
133
|
+
// if (params.normalMap)
|
|
134
|
+
// {
|
|
135
|
+
// processCount++
|
|
136
|
+
// LYMaterialLibrary.loadTexture("normalMap", mat, world, params.normalMap, onTextureLoaded)
|
|
137
|
+
// }
|
|
138
|
+
|
|
139
|
+
// // roughnessMap
|
|
140
|
+
// if (params.roughnessMap)
|
|
141
|
+
// {
|
|
142
|
+
// processCount++
|
|
143
|
+
// LYMaterialLibrary.loadTexture("roughnessMap", mat, world, params.roughnessMap, onTextureLoaded)
|
|
144
|
+
// }
|
|
145
|
+
|
|
146
|
+
// // metalnessMap
|
|
147
|
+
// if (params.metalnessMap)
|
|
148
|
+
// {
|
|
149
|
+
// processCount++
|
|
150
|
+
// LYMaterialLibrary.loadTexture("metalnessMap", mat, world, params.metalnessMap, onTextureLoaded)
|
|
151
|
+
// }
|
|
152
|
+
// mat.needsUpdate = true
|
|
153
|
+
// }
|
|
154
|
+
|
|
155
|
+
// static Serialize(mat: MeshStandardMaterial, world: LYThreeWorld)
|
|
156
|
+
// {
|
|
157
|
+
// interface obj
|
|
158
|
+
// {
|
|
159
|
+
// [idx: string]: any
|
|
160
|
+
// }
|
|
161
|
+
|
|
162
|
+
// let params: obj = {}
|
|
163
|
+
|
|
164
|
+
// if (mat.color)
|
|
165
|
+
// {
|
|
166
|
+
// params.color = `rgb\(${Math.trunc(mat.color.r * 255)}, ${Math.trunc(mat.color.g * 255)}, ${Math.trunc(mat.color.b * 255)}\)`
|
|
167
|
+
// }
|
|
168
|
+
// // roughness
|
|
169
|
+
// if (mat.roughness)
|
|
170
|
+
// {
|
|
171
|
+
// params.roughness = mat.roughness;
|
|
172
|
+
// }
|
|
173
|
+
// if (mat.metalness)
|
|
174
|
+
// {
|
|
175
|
+
// params.metalness = mat.metalness;
|
|
176
|
+
// }
|
|
177
|
+
// // side
|
|
178
|
+
// if (mat.side)
|
|
179
|
+
// {
|
|
180
|
+
// params.side = mat.side;
|
|
181
|
+
// }
|
|
182
|
+
// // blending
|
|
183
|
+
// if (mat.blending)
|
|
184
|
+
// {
|
|
185
|
+
// params.blending = mat.blending;
|
|
186
|
+
// }
|
|
187
|
+
// // opacity
|
|
188
|
+
// if (mat.opacity)
|
|
189
|
+
// {
|
|
190
|
+
// params.opacity = mat.opacity;
|
|
191
|
+
// }
|
|
192
|
+
// // transparent
|
|
193
|
+
// params.transparent = mat.transparent ? true : false;
|
|
194
|
+
// // depthTest
|
|
195
|
+
// params.depthTest = mat.depthTest ? true : false;
|
|
196
|
+
// // depthWrite
|
|
197
|
+
// params.depthWrite = mat.depthWrite ? true : false;
|
|
198
|
+
// // wireframe
|
|
199
|
+
// params.wireframe = mat.wireframe ? true : false;
|
|
200
|
+
|
|
201
|
+
// params.name = mat.name
|
|
202
|
+
// // world.AssetManager?.findAssetByName(AssetType.texture, )
|
|
203
|
+
// // map
|
|
204
|
+
|
|
205
|
+
// LYMaterialLibrary.SerializeTexture("map", mat, world, params)
|
|
206
|
+
// LYMaterialLibrary.SerializeTexture("emissiveMap", mat, world, params)
|
|
207
|
+
// LYMaterialLibrary.SerializeTexture("alphaMap", mat, world, params)
|
|
208
|
+
// LYMaterialLibrary.SerializeTexture("normalMap", mat, world, params)
|
|
209
|
+
// LYMaterialLibrary.SerializeTexture("roughnessMap", mat, world, params)
|
|
210
|
+
// LYMaterialLibrary.SerializeTexture("metalnessMap", mat, world, params)
|
|
211
|
+
|
|
212
|
+
// return {
|
|
213
|
+
// type : "material",
|
|
214
|
+
// params: params,
|
|
215
|
+
// }
|
|
216
|
+
// }
|
|
217
|
+
|
|
218
|
+
// static SerializeTexture(key: string, material: Material, world: LYThreeWorld, paramsToMod)
|
|
219
|
+
// {
|
|
220
|
+
// if (!(key in material) || !(material[key] instanceof Texture))
|
|
221
|
+
// {
|
|
222
|
+
// return
|
|
223
|
+
// }
|
|
224
|
+
// let asset = world.AssetManager?.findAssetByUUID(AssetType.texture, material[key].uuid)
|
|
225
|
+
// if (asset && asset.Path !== "")
|
|
226
|
+
// {
|
|
227
|
+
// paramsToMod[key] = {
|
|
228
|
+
// url : asset.Path,
|
|
229
|
+
// offset: material[key].offset.toArray(),
|
|
230
|
+
// repeat: material[key].repeat.toArray()
|
|
231
|
+
// }
|
|
232
|
+
// }
|
|
233
|
+
// }
|
|
234
|
+
|
|
235
|
+
// static loadTexture(key: string, material: Material, world: LYThreeWorld, data, onTextureLoaded: Function = ()=>{})
|
|
236
|
+
// {
|
|
237
|
+
// if (!data.url || data.url.length == 0)
|
|
238
|
+
// {
|
|
239
|
+
// material[key] = null;
|
|
240
|
+
// material.needsUpdate = true
|
|
241
|
+
// onTextureLoaded()
|
|
242
|
+
|
|
243
|
+
// return
|
|
244
|
+
// }
|
|
245
|
+
// let texture = new TextureLoader(world.AssetManager.LoadingManager).load(data.url, (dataLoad: Texture) =>
|
|
246
|
+
// {
|
|
247
|
+
// console.log("loadTexture")
|
|
248
|
+
// onTextureLoaded()
|
|
249
|
+
// world.markRenderStateDirty();
|
|
250
|
+
// }, (event: ProgressEvent) => {}, (err: unknown) => {});
|
|
251
|
+
// texture.wrapS = RepeatWrapping;
|
|
252
|
+
// texture.wrapT = RepeatWrapping;
|
|
253
|
+
// texture.flipY = false
|
|
254
|
+
// if (data.repeat)
|
|
255
|
+
// {
|
|
256
|
+
// texture.repeat = new Vector2().fromArray(data.repeat);
|
|
257
|
+
// }
|
|
258
|
+
// else
|
|
259
|
+
// {
|
|
260
|
+
// texture.repeat = new Vector2().fromArray([1, 1]);
|
|
261
|
+
// }
|
|
262
|
+
// if (data.offset)
|
|
263
|
+
// {
|
|
264
|
+
// texture.offset = new Vector2().fromArray(data.offset);
|
|
265
|
+
// }
|
|
266
|
+
// else
|
|
267
|
+
// {
|
|
268
|
+
// texture.offset = new Vector2().fromArray([0, 0]);
|
|
269
|
+
// }
|
|
270
|
+
// material[key] = texture;
|
|
271
|
+
// world.AssetManager?.addTextureAsset(texture, data.url, data.url);
|
|
272
|
+
// world.markRenderStateDirty();
|
|
273
|
+
// }
|
|
274
|
+
|
|
275
|
+
// static convertTextureToBase64(texture: Texture)
|
|
276
|
+
// {
|
|
277
|
+
// // 创建一个canvas元素
|
|
278
|
+
// let canvas = document.createElement('canvas');
|
|
279
|
+
// canvas.width = texture.image.width;
|
|
280
|
+
// canvas.height = texture.image.height;
|
|
281
|
+
|
|
282
|
+
// // 将贴图绘制到canvas上
|
|
283
|
+
// let ctx = canvas.getContext('2d');
|
|
284
|
+
// if(!ctx)
|
|
285
|
+
// {
|
|
286
|
+
// return null
|
|
287
|
+
// }
|
|
288
|
+
// ctx.drawImage(texture.image, 0, 0, canvas.width, canvas.height);
|
|
289
|
+
// return canvas.toDataURL()
|
|
290
|
+
// }
|
|
291
|
+
// }
|
|
292
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Vector3, Matrix4, Quaternion, Object3D, Box3, Plane} from "three";
|
|
1
|
+
import {Vector3, Matrix4, Quaternion, Object3D, Box3, Plane, Euler} from "three";
|
|
2
2
|
|
|
3
3
|
export interface Segment
|
|
4
4
|
{
|
|
@@ -8,17 +8,17 @@ export interface Segment
|
|
|
8
8
|
|
|
9
9
|
export class LYMath
|
|
10
10
|
{
|
|
11
|
-
static degreeToRadians(degree): number
|
|
11
|
+
static degreeToRadians(degree:number): number
|
|
12
12
|
{
|
|
13
13
|
return degree * (Math.PI / 180);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
static radiansToDegree(radians): number
|
|
16
|
+
static radiansToDegree(radians:number): number
|
|
17
17
|
{
|
|
18
18
|
return radians * (180 / Math.PI);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
static threeJsEulerAngleAsDegree(euler)
|
|
21
|
+
static threeJsEulerAngleAsDegree(euler:Euler)
|
|
22
22
|
{
|
|
23
23
|
return {
|
|
24
24
|
x: LYMath.radiansToDegree(euler.x),
|
|
@@ -3,8 +3,8 @@ import {BaseObject} from "./BaseObject";
|
|
|
3
3
|
import {MeshComponent} from "./Components/Mesh/MeshComponent";
|
|
4
4
|
import {AttachmentRules} from "../Defines";
|
|
5
5
|
|
|
6
|
-
import {SceneComponent} from "./Components/SceneComponent
|
|
7
|
-
import { World } from "../Frame/World
|
|
6
|
+
import {SceneComponent} from "./Components/SceneComponent";
|
|
7
|
+
import { World } from "../Frame/World";
|
|
8
8
|
|
|
9
9
|
export class Actor extends BaseObject
|
|
10
10
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import {ColorRepresentation} from "three";
|
|
3
|
-
import {Actor} from "../../Actor
|
|
4
|
-
import {DirectionalLightComponent} from "../../Components/Light/DirectionalLight/DirectionalLightComponent
|
|
3
|
+
import {Actor} from "../../Actor";
|
|
4
|
+
import {DirectionalLightComponent} from "../../Components/Light/DirectionalLight/DirectionalLightComponent";
|
|
5
5
|
|
|
6
6
|
export class DirectionalLightActor extends Actor
|
|
7
7
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import {Material, MeshBasicMaterial} from "three";
|
|
3
|
-
import {Actor} from "../../Actor
|
|
4
|
-
import {BoxComponent} from "../../Components/Mesh/Shape/BoxComponent
|
|
3
|
+
import {Actor} from "../../Actor";
|
|
4
|
+
import {BoxComponent} from "../../Components/Mesh/Shape/BoxComponent";
|
|
5
5
|
|
|
6
6
|
export class BoxActor extends Actor
|
|
7
7
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import {Material, MeshBasicMaterial} from "three";
|
|
3
|
-
import {Actor} from "../../Actor
|
|
4
|
-
import {PlaneComponent} from "../../Components/Mesh/Shape/PlaneComponent
|
|
3
|
+
import {Actor} from "../../Actor";
|
|
4
|
+
import {PlaneComponent} from "../../Components/Mesh/Shape/PlaneComponent";
|
|
5
5
|
|
|
6
6
|
export class PlaneActor extends Actor
|
|
7
7
|
{
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
// import {Material, MeshBasicMaterial} from "three";
|
|
3
|
+
// import {Actor} from "../../Actor";
|
|
4
|
+
|
|
5
|
+
// export class LYTubeActor extends Actor
|
|
6
|
+
// {
|
|
7
|
+
// constructor(width:number = 1, height:number = 1, depth:number = 1, material:Material = new MeshBasicMaterial())
|
|
8
|
+
// {
|
|
9
|
+
// // const points = [{
|
|
10
|
+
// // x: 0,
|
|
11
|
+
// // y: 0,
|
|
12
|
+
// // z: 0
|
|
13
|
+
// // },
|
|
14
|
+
// // {
|
|
15
|
+
// // x: 100,
|
|
16
|
+
// // y: 0,
|
|
17
|
+
// // z: 0
|
|
18
|
+
// // },
|
|
19
|
+
// // {
|
|
20
|
+
// // x: 100,
|
|
21
|
+
// // y: 0,
|
|
22
|
+
// // z: 200
|
|
23
|
+
// // },
|
|
24
|
+
// // ];
|
|
25
|
+
// //
|
|
26
|
+
// // const path = createPath(points);
|
|
27
|
+
// //
|
|
28
|
+
// // const pipeGeometry = new TubeGeometry(path, 256, radius, 64);
|
|
29
|
+
// // const pipeMaterial = new MeshPhongMaterial({
|
|
30
|
+
// // color
|
|
31
|
+
// // });
|
|
32
|
+
// // const pipe = new Mesh(pipeGeometry, pipeMaterial);
|
|
33
|
+
// //
|
|
34
|
+
// // super();
|
|
35
|
+
// // this.addComponent(new LYBoxComponent(width, height, depth, material))
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { CSS2DObject } from "three/examples/jsm/renderers/CSS2DRenderer.js";
|
|
4
4
|
import { Vector2} from "three";
|
|
5
|
-
import {SceneComponent} from "../SceneComponent
|
|
5
|
+
import {SceneComponent} from "../SceneComponent";
|
|
6
6
|
|
|
7
7
|
export class LabelComponent extends SceneComponent
|
|
8
8
|
{
|
|
@@ -36,7 +36,7 @@ export abstract class Component extends BaseObject
|
|
|
36
36
|
this._name = name;
|
|
37
37
|
}
|
|
38
38
|
protected obj:Object3D|null = null;
|
|
39
|
-
|
|
39
|
+
protected _parentActor:Actor | null = null;
|
|
40
40
|
protected _name = "Component";
|
|
41
41
|
protected constructor(newThreeObject:Object3D)
|
|
42
42
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Group, Matrix4, Mesh, Object3D,} from "three";
|
|
2
|
-
import {SceneComponent} from "../../SceneComponent
|
|
3
|
-
import {LYInstanceMeshComponent} from "./InstanceMeshComponent
|
|
2
|
+
import {SceneComponent} from "../../SceneComponent";
|
|
3
|
+
import {LYInstanceMeshComponent} from "./InstanceMeshComponent";
|
|
4
4
|
|
|
5
5
|
interface MeshData
|
|
6
6
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {BufferGeometry, Material, Mesh, Texture} from 'three';
|
|
2
2
|
import {Vector3} from "three";
|
|
3
|
-
import {SceneComponent} from "../SceneComponent
|
|
4
|
-
import {LYAssetManager} from
|
|
3
|
+
import {SceneComponent} from "../SceneComponent";
|
|
4
|
+
import { LYAssetManager } from '../../../../index';
|
|
5
5
|
|
|
6
6
|
export class MeshComponent extends SceneComponent
|
|
7
7
|
{
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import {Actor} from "../Actor
|
|
1
|
+
import {Actor} from "../Actor";
|
|
2
2
|
import {Box3, Euler, Group, Matrix4, Object3D, Quaternion, Vector3} from "three";
|
|
3
|
-
import {Component} from "./Component
|
|
4
|
-
import { World } from "../../Frame/World
|
|
5
|
-
import { AttachmentRules } from "
|
|
3
|
+
import {Component} from "./Component";
|
|
4
|
+
import { World } from "../../Frame/World";
|
|
5
|
+
import { AttachmentRules } from "../../Defines";
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
export class SceneComponent extends Component
|
|
8
9
|
{
|
|
9
|
-
set parentActor(value:Actor | null)
|
|
10
|
+
override set parentActor(value:Actor | null)
|
|
10
11
|
{
|
|
11
12
|
this.childrenComponents.forEach((elem) =>
|
|
12
13
|
{
|
|
13
14
|
elem.parentActor = value;
|
|
14
15
|
});
|
|
15
|
-
|
|
16
|
+
this._parentActor = value;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
get parentActor():Actor | null
|
|
19
|
+
override get parentActor():Actor | null
|
|
19
20
|
{
|
|
20
|
-
|
|
21
|
+
// 通过 _parentActor 私有字段访问父级 Actor
|
|
22
|
+
return this._parentActor;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
protected bCanHover:boolean = false;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
// import {LYDelegate} from "../../Delegate";
|
|
7
7
|
// import {LYThreeWorld} from "../../Frame";
|
|
8
8
|
|
|
9
|
-
// import {SceneComponent} from "../Components/SceneComponent
|
|
10
|
-
// import {PawnBase} from "../Pawn/PawnBase
|
|
9
|
+
// import {SceneComponent} from "../Components/SceneComponent";
|
|
10
|
+
// import {PawnBase} from "../Pawn/PawnBase";
|
|
11
11
|
|
|
12
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
13
|
|