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,221 +0,0 @@
|
|
|
1
|
-
// import {BufferGeometry, CatmullRomCurve3, EllipseCurve, Material, Vector3} from "three";
|
|
2
|
-
// import {LYBaseMeshComponent} from "../MeshComponent";
|
|
3
|
-
// import {Line2} from 'three/examples/jsm/lines/Line2.js';
|
|
4
|
-
// import {LineGeometry} from 'three/examples/jsm/lines/LineGeometry.js';
|
|
5
|
-
// import {CurveType} from "three/src/extras/curves/CatmullRomCurve3";
|
|
6
|
-
// import {LineMaterial} from "three/examples/jsm/lines/LineMaterial";
|
|
7
|
-
//
|
|
8
|
-
// export class LYCurveComponent extends LYBaseMeshComponent
|
|
9
|
-
// {
|
|
10
|
-
// points:Vector3[] = [];
|
|
11
|
-
// sourcePoints:Vector3[] = [];
|
|
12
|
-
// curve:CatmullRomCurve3;
|
|
13
|
-
//
|
|
14
|
-
// private closed:boolean;
|
|
15
|
-
// private curveType:CurveType;
|
|
16
|
-
// private tension:number;
|
|
17
|
-
//
|
|
18
|
-
// constructor(points:Vector3[], material:LineMaterial, tension = 0, closed = false, curveType:CurveType = 'centripetal')
|
|
19
|
-
// {
|
|
20
|
-
//
|
|
21
|
-
// super(new Line2(), material);
|
|
22
|
-
//
|
|
23
|
-
// this.closed = closed;
|
|
24
|
-
// this.curveType = curveType;
|
|
25
|
-
// this.tension = tension;
|
|
26
|
-
// this.sourcePoints = points;
|
|
27
|
-
// this.curve = new CatmullRomCurve3(points, closed, curveType, tension);
|
|
28
|
-
// // this.#points = this.#curve.getPoints( points.length * 10 );
|
|
29
|
-
// this.points = this.curve.getPoints(points.length * (this.tension === 0 ? 1 : 10) - 1);
|
|
30
|
-
// this.createLine();
|
|
31
|
-
// }
|
|
32
|
-
//
|
|
33
|
-
// resetPoints(points:Vector3[])
|
|
34
|
-
// {
|
|
35
|
-
//
|
|
36
|
-
// this.sourcePoints = points;
|
|
37
|
-
// this.curve = new CatmullRomCurve3(points, this.closed, this.curveType, this.tension);
|
|
38
|
-
// this.points = this.curve.getPoints(points.length * (this.tension === 0 ? 1 : 10) - 1);
|
|
39
|
-
// this.createLine();
|
|
40
|
-
// }
|
|
41
|
-
//
|
|
42
|
-
// createLine()
|
|
43
|
-
// {
|
|
44
|
-
// let positions = [];
|
|
45
|
-
// for (let i = 0; i < this.points.length; ++i)
|
|
46
|
-
// {
|
|
47
|
-
// positions.push(this.points[i].x);
|
|
48
|
-
// positions.push(this.points[i].y);
|
|
49
|
-
// positions.push(this.points[i].z);
|
|
50
|
-
// }
|
|
51
|
-
//
|
|
52
|
-
// const geometry = new LineGeometry();
|
|
53
|
-
// geometry.setPositions(positions);
|
|
54
|
-
//
|
|
55
|
-
// if (!this.threeObject || !this.threeObject.isLine2)
|
|
56
|
-
// {
|
|
57
|
-
// this.threeObject = new Line2(geometry, this.#material);
|
|
58
|
-
// }
|
|
59
|
-
// else
|
|
60
|
-
// {
|
|
61
|
-
// if (this.threeObject.isMesh)
|
|
62
|
-
// {
|
|
63
|
-
// this.threeObject.geometry.dispose();
|
|
64
|
-
// this.threeObject.geometry = null;
|
|
65
|
-
// }
|
|
66
|
-
//
|
|
67
|
-
// this.threeObject.geometry = new BufferGeometry().setFromPoints(this.points);
|
|
68
|
-
// }
|
|
69
|
-
//
|
|
70
|
-
// }
|
|
71
|
-
//
|
|
72
|
-
// onAddedToWorld(world)
|
|
73
|
-
// {
|
|
74
|
-
// super.onAddedToWorld(world);
|
|
75
|
-
// }
|
|
76
|
-
//
|
|
77
|
-
// destroy()
|
|
78
|
-
// {
|
|
79
|
-
// if (this.isValid())
|
|
80
|
-
// {
|
|
81
|
-
// if (this.threeObject.isMesh)
|
|
82
|
-
// {
|
|
83
|
-
// this.threeObject.geometry.dispose();
|
|
84
|
-
// this.threeObject.geometry = null;
|
|
85
|
-
// }
|
|
86
|
-
// this.threeObject = null;
|
|
87
|
-
//
|
|
88
|
-
// this.#material.dispose();
|
|
89
|
-
// this.#material = null;
|
|
90
|
-
// }
|
|
91
|
-
// this.world = null;
|
|
92
|
-
// }
|
|
93
|
-
//
|
|
94
|
-
// get SourcePoints()
|
|
95
|
-
// {
|
|
96
|
-
// return this.#sourcePoints;
|
|
97
|
-
// }
|
|
98
|
-
//
|
|
99
|
-
// get Curve()
|
|
100
|
-
// {
|
|
101
|
-
// return this.#curve;
|
|
102
|
-
// }
|
|
103
|
-
//
|
|
104
|
-
// get Points()
|
|
105
|
-
// {
|
|
106
|
-
// return this.#points;
|
|
107
|
-
// }
|
|
108
|
-
//
|
|
109
|
-
// getPointAt(u)
|
|
110
|
-
// {
|
|
111
|
-
// return this.#curve.getPointAt(u);
|
|
112
|
-
// }
|
|
113
|
-
//
|
|
114
|
-
// getTangentAt(u)
|
|
115
|
-
// {
|
|
116
|
-
// return this.#curve.getTangentAt(u);
|
|
117
|
-
// }
|
|
118
|
-
//
|
|
119
|
-
// getLength()
|
|
120
|
-
// {
|
|
121
|
-
// return this.#curve.getLength();
|
|
122
|
-
// }
|
|
123
|
-
//
|
|
124
|
-
// }
|
|
125
|
-
//
|
|
126
|
-
//
|
|
127
|
-
// export class LYArcComponent extends CurveComponent
|
|
128
|
-
// {
|
|
129
|
-
// #points;
|
|
130
|
-
// #curve;
|
|
131
|
-
// #closed;
|
|
132
|
-
// #bCreateLine;
|
|
133
|
-
//
|
|
134
|
-
// constructor(bCreateLine, material, origin, xRadius, yRadius, startAngle = 0, endAngle = Math.PI * 2, bClockwise = false, rotation = 0)
|
|
135
|
-
// {
|
|
136
|
-
// super(null, null);
|
|
137
|
-
// this.#closed = closed;
|
|
138
|
-
// this.#bCreateLine = bCreateLine;
|
|
139
|
-
// this.#curve = new EllipseCurve(origin.x, origin.y, xRadius, yRadius, startAngle, endAngle, bClockwise, rotation);
|
|
140
|
-
// this.#points = this.#curve.getPoints(50);
|
|
141
|
-
//
|
|
142
|
-
// this.material = material;
|
|
143
|
-
// if (this.#bCreateLine)
|
|
144
|
-
// {
|
|
145
|
-
// this.createLine();
|
|
146
|
-
// }
|
|
147
|
-
// }
|
|
148
|
-
//
|
|
149
|
-
// isValid()
|
|
150
|
-
// {
|
|
151
|
-
// return this.threeObject != null;
|
|
152
|
-
// }
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
// createLine()
|
|
156
|
-
// {
|
|
157
|
-
// let positions = [];
|
|
158
|
-
// for (let i = 0; i < this.#points.length; ++i)
|
|
159
|
-
// {
|
|
160
|
-
// positions.push(this.#points[i].x);
|
|
161
|
-
// // positions.push(this.#points[i].y)
|
|
162
|
-
// positions.push(0);
|
|
163
|
-
// positions.push(this.#points[i].y);
|
|
164
|
-
// }
|
|
165
|
-
//
|
|
166
|
-
// this.geometry = new LineGeometry();
|
|
167
|
-
// this.geometry.setPositions(positions);
|
|
168
|
-
// if (!this.threeObject || !this.threeObject.isLine2)
|
|
169
|
-
// {
|
|
170
|
-
// this.threeObject = new Line2(this.geometry, this.material);
|
|
171
|
-
// }
|
|
172
|
-
// // console.log(this.#points, positions, this.threeObject)
|
|
173
|
-
// // else
|
|
174
|
-
// // {
|
|
175
|
-
// // this.threeObject.geometry.dispose()
|
|
176
|
-
// // this.threeObject.geometry = null
|
|
177
|
-
// // this.threeObject.geometry = new LineGeometry();
|
|
178
|
-
// // this.threeObject.geometry.setPositions( positions )
|
|
179
|
-
// // }
|
|
180
|
-
//
|
|
181
|
-
// }
|
|
182
|
-
//
|
|
183
|
-
// onAddedToWorld(world)
|
|
184
|
-
// {
|
|
185
|
-
// super.onAddedToWorld(world);
|
|
186
|
-
// }
|
|
187
|
-
//
|
|
188
|
-
// destroy()
|
|
189
|
-
// {
|
|
190
|
-
// if (this.isValid())
|
|
191
|
-
// {
|
|
192
|
-
// this.threeObject = null;
|
|
193
|
-
// this.geometry.dispose();
|
|
194
|
-
// this.geometry = null;
|
|
195
|
-
// this.material.dispose();
|
|
196
|
-
// this.material = null;
|
|
197
|
-
// }
|
|
198
|
-
// this.world = null;
|
|
199
|
-
// }
|
|
200
|
-
//
|
|
201
|
-
// get Points()
|
|
202
|
-
// {
|
|
203
|
-
// return this.#points;
|
|
204
|
-
// }
|
|
205
|
-
//
|
|
206
|
-
// getPointAt(u)
|
|
207
|
-
// {
|
|
208
|
-
// return this.#curve.getPointAt(u);
|
|
209
|
-
// }
|
|
210
|
-
//
|
|
211
|
-
// getTangentAt(u)
|
|
212
|
-
// {
|
|
213
|
-
// return this.#curve.getTangentAt(u);
|
|
214
|
-
// }
|
|
215
|
-
//
|
|
216
|
-
// getLength()
|
|
217
|
-
// {
|
|
218
|
-
// return this.#curve.getLength();
|
|
219
|
-
// }
|
|
220
|
-
//
|
|
221
|
-
// }
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import {BufferGeometry, Material, Mesh, Texture} from 'three';
|
|
2
|
-
import {Vector3} from "three";
|
|
3
|
-
import {SceneComponent} from "../SceneComponent";
|
|
4
|
-
import { LYAssetManager } from '../../../../index';
|
|
5
|
-
|
|
6
|
-
export class MeshComponent extends SceneComponent
|
|
7
|
-
{
|
|
8
|
-
get threeObject():Mesh|null
|
|
9
|
-
{
|
|
10
|
-
return this.obj;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
set threeObject(newThreeObject:Mesh)
|
|
14
|
-
{
|
|
15
|
-
this.obj = newThreeObject;
|
|
16
|
-
if (this.obj)
|
|
17
|
-
{
|
|
18
|
-
this.obj.userData["LYObject"] = this;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
protected obj:Mesh|null = null;
|
|
23
|
-
|
|
24
|
-
get geometry():BufferGeometry | null
|
|
25
|
-
{
|
|
26
|
-
return this.threeObject ? this.threeObject.geometry : null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
set geometry(geo:BufferGeometry)
|
|
30
|
-
{
|
|
31
|
-
if (!this.threeObject)
|
|
32
|
-
{
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
this.threeObject.geometry = geo;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get material():Material | Material[] | null
|
|
39
|
-
{
|
|
40
|
-
return this.threeObject ? this.threeObject.material : null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
set material(newMat:Material | Material[])
|
|
44
|
-
{
|
|
45
|
-
if (!this.threeObject)
|
|
46
|
-
{
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
this.threeObject.material = newMat;
|
|
50
|
-
if (this.world)
|
|
51
|
-
{
|
|
52
|
-
this.world.viewport.markRenderStateDirty();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
constructor(mesh:Mesh);
|
|
57
|
-
constructor(geometry:BufferGeometry, material:Material | Material[] | null);
|
|
58
|
-
constructor(...args:any[])
|
|
59
|
-
{
|
|
60
|
-
let newMesh:Mesh | null = null;
|
|
61
|
-
if (args[0] instanceof Mesh)
|
|
62
|
-
{
|
|
63
|
-
newMesh = args[0];
|
|
64
|
-
}
|
|
65
|
-
else
|
|
66
|
-
{
|
|
67
|
-
if (args[0] instanceof BufferGeometry && (args[1] instanceof Material || Array.isArray(args[1])))
|
|
68
|
-
{
|
|
69
|
-
newMesh = new Mesh(args[0], args[1]);
|
|
70
|
-
}
|
|
71
|
-
else
|
|
72
|
-
{
|
|
73
|
-
throw new Error('Invalid arguments for A constructor');
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
super(newMesh);
|
|
77
|
-
this.threeObject = newMesh;
|
|
78
|
-
LYAssetManager.Get().checkMeshResource(newMesh)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
set castShadow(bCast:boolean)
|
|
82
|
-
{
|
|
83
|
-
if(this.threeObject)
|
|
84
|
-
this.threeObject.castShadow = bCast;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
get castShadow()
|
|
88
|
-
{
|
|
89
|
-
return this.threeObject ? this.threeObject.castShadow : false;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
set receiveShadow(bReceive)
|
|
93
|
-
{
|
|
94
|
-
if (!this.threeObject)
|
|
95
|
-
{
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
this.threeObject.receiveShadow = bReceive;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
get receiveShadow()
|
|
102
|
-
{
|
|
103
|
-
return this.threeObject ? this.threeObject.receiveShadow : false;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
getBoundsCenterPosition()
|
|
107
|
-
{
|
|
108
|
-
let ret = new Vector3();
|
|
109
|
-
this.getBounds().getCenter(ret);
|
|
110
|
-
return ret;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
getBoundsTopCenterPosition()
|
|
114
|
-
{
|
|
115
|
-
let ret = new Vector3();
|
|
116
|
-
let bounds = this.getBounds();
|
|
117
|
-
bounds.getCenter(ret);
|
|
118
|
-
ret.y = bounds.max.y;
|
|
119
|
-
return ret;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
getBoundsBottomCenterPosition()
|
|
123
|
-
{
|
|
124
|
-
let ret = new Vector3();
|
|
125
|
-
let bounds = this.getBounds();
|
|
126
|
-
bounds.getCenter(ret);
|
|
127
|
-
ret.y = bounds.min.y;
|
|
128
|
-
return ret;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
destroyObject()
|
|
132
|
-
{
|
|
133
|
-
if (this.world && this.world.scene && this.threeObject)
|
|
134
|
-
{
|
|
135
|
-
this.world.scene.remove(this.threeObject);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
let assetManager = LYAssetManager.Get();
|
|
139
|
-
|
|
140
|
-
const mats = Array.isArray(this.material) ? this.material : [this.material];
|
|
141
|
-
mats.forEach((material) => {
|
|
142
|
-
if (material instanceof Material) {
|
|
143
|
-
Object.entries(material).forEach(([key, value]) => {
|
|
144
|
-
if (value instanceof Texture)
|
|
145
|
-
{
|
|
146
|
-
assetManager.releaseAsset(value);
|
|
147
|
-
value = null;
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
assetManager.releaseAsset(material);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
this.material = [];
|
|
154
|
-
|
|
155
|
-
if (this.geometry instanceof BufferGeometry)
|
|
156
|
-
{
|
|
157
|
-
assetManager.releaseAsset(this.geometry);
|
|
158
|
-
(this.geometry as any) = null;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {BoxGeometry, Material, MeshStandardMaterial} from "three";
|
|
2
|
-
import {MeshComponent} from "../MeshComponent";
|
|
3
|
-
|
|
4
|
-
export class BoxComponent extends MeshComponent
|
|
5
|
-
{
|
|
6
|
-
constructor(
|
|
7
|
-
width:number = 1,
|
|
8
|
-
height:number = 1,
|
|
9
|
-
depth:number = 1,
|
|
10
|
-
widthSegments:number = 1,
|
|
11
|
-
heightSegments:number = 1,
|
|
12
|
-
depthSegments:number = 1,
|
|
13
|
-
material:Material = new MeshStandardMaterial())
|
|
14
|
-
{
|
|
15
|
-
super(new BoxGeometry(width, height, depth, widthSegments, heightSegments, depthSegments), material);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {Material, PlaneGeometry} from "three";
|
|
2
|
-
import {MeshComponent} from "../MeshComponent";
|
|
3
|
-
|
|
4
|
-
export class PlaneComponent extends MeshComponent
|
|
5
|
-
{
|
|
6
|
-
constructor(width:number, height:number, material:Material, widthSegments:number = 1, heightSegments:number = 1)
|
|
7
|
-
{
|
|
8
|
-
super(new PlaneGeometry(width, height, widthSegments, heightSegments), material)
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {MeshBasicMaterial, SphereGeometry} from "three";
|
|
2
|
-
import {MeshComponent} from "../MeshComponent";
|
|
3
|
-
|
|
4
|
-
export class SphereComponent extends MeshComponent
|
|
5
|
-
{
|
|
6
|
-
constructor(radius:number, material = new MeshBasicMaterial(), widthSegments = 32, heightSegments = 16)
|
|
7
|
-
{
|
|
8
|
-
super(new SphereGeometry(radius, widthSegments, heightSegments), material)
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {Sprite, SpriteMaterial, Texture} from "three";
|
|
2
|
-
import {SceneComponent} from "../../SceneComponent";
|
|
3
|
-
|
|
4
|
-
export class SpriteComponent extends SceneComponent
|
|
5
|
-
{
|
|
6
|
-
get threeObject():Sprite
|
|
7
|
-
{
|
|
8
|
-
return this.obj;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
set threeObject(newThreeObject:Sprite)
|
|
12
|
-
{
|
|
13
|
-
this.obj = newThreeObject;
|
|
14
|
-
if (this.obj)
|
|
15
|
-
{
|
|
16
|
-
this.obj.userData["LYObject"] = this;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
protected obj:Sprite;
|
|
20
|
-
|
|
21
|
-
constructor(texture:Texture)
|
|
22
|
-
{
|
|
23
|
-
let material = new SpriteMaterial(
|
|
24
|
-
{
|
|
25
|
-
map:texture
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
let sprite = new Sprite(material);
|
|
29
|
-
super(sprite)
|
|
30
|
-
this.obj = sprite
|
|
31
|
-
}
|
|
32
|
-
}
|