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,571 +0,0 @@
|
|
|
1
|
-
import {Mesh, Vector3, Quaternion, Euler, Matrix4, Object3D, Group} from "three";
|
|
2
|
-
import {BaseObject} from "./BaseObject";
|
|
3
|
-
import {MeshComponent} from "./Components/Mesh/MeshComponent";
|
|
4
|
-
import {AttachmentRules} from "../Defines";
|
|
5
|
-
|
|
6
|
-
import {SceneComponent} from "./Components/SceneComponent";
|
|
7
|
-
import { World } from "../Frame/World";
|
|
8
|
-
|
|
9
|
-
export class Actor extends BaseObject
|
|
10
|
-
{
|
|
11
|
-
get world()
|
|
12
|
-
{
|
|
13
|
-
return this._world;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get name():string
|
|
17
|
-
{
|
|
18
|
-
console.log("getname", this._name)
|
|
19
|
-
return this._name;
|
|
20
|
-
}
|
|
21
|
-
set name(name:string)
|
|
22
|
-
{
|
|
23
|
-
this._name = name;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get rootComponent():SceneComponent
|
|
27
|
-
{
|
|
28
|
-
if(!this._rootComponent)
|
|
29
|
-
{
|
|
30
|
-
throw Error("rootComponent is invalid")
|
|
31
|
-
}
|
|
32
|
-
return this._rootComponent;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
set rootComponent(newRoot:SceneComponent)
|
|
36
|
-
{
|
|
37
|
-
newRoot.detachFromParentComponent();
|
|
38
|
-
newRoot.parentActor = this;
|
|
39
|
-
if (this._rootComponent)
|
|
40
|
-
{
|
|
41
|
-
let child = this.rootComponent.childrenComponents;
|
|
42
|
-
for (let i = 0; i < child.length; ++i)
|
|
43
|
-
{
|
|
44
|
-
newRoot.addChildComponent(child[i]);
|
|
45
|
-
}
|
|
46
|
-
this.rootComponent.destroy();
|
|
47
|
-
}
|
|
48
|
-
this._rootComponent = newRoot;
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
get childrenComponents()
|
|
53
|
-
{
|
|
54
|
-
return this.rootComponent.childrenComponents;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
get childActors():Actor[]
|
|
58
|
-
{
|
|
59
|
-
let ret:Actor[] = []
|
|
60
|
-
this.rootComponent.threeObject?.children.forEach((elem) =>{
|
|
61
|
-
let p = elem.userData["LYObject"]?.parentActor;
|
|
62
|
-
if(p !== this && p instanceof Actor)
|
|
63
|
-
{
|
|
64
|
-
ret.push(p);
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
return ret;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
get parentActor():Actor|null
|
|
71
|
-
{
|
|
72
|
-
let parent = this.rootComponent.threeObject?.parent?.userData["LYObject"].parentActor as Actor|null;
|
|
73
|
-
return parent === this ? null: parent;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
get isVisible():boolean
|
|
77
|
-
{
|
|
78
|
-
return this.rootComponent ? this.rootComponent.isVisible : false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
protected _name:string = "Actor"
|
|
82
|
-
|
|
83
|
-
protected _rootComponent: SceneComponent|null = null;
|
|
84
|
-
protected _world : World | null = null;
|
|
85
|
-
|
|
86
|
-
protected onClickedEvent : ((component?:SceneComponent) => void)[] = [];
|
|
87
|
-
protected onDoubleClickedEvent : ((component?:SceneComponent) => void)[] = [];
|
|
88
|
-
protected onHoverBeginEvent: ((component?:SceneComponent) => void)[] = [];
|
|
89
|
-
protected onHoverEndEvent : ((component?:SceneComponent) => void)[] = [];
|
|
90
|
-
|
|
91
|
-
constructor(myThreeObject:Object3D|null = null)
|
|
92
|
-
{
|
|
93
|
-
super();
|
|
94
|
-
this.constructRootComponent(myThreeObject);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
protected constructRootComponent(myThreeObject:Object3D|null = null)
|
|
98
|
-
{
|
|
99
|
-
let tObject = myThreeObject ? myThreeObject : new Group()
|
|
100
|
-
if ((tObject as any).isMesh)
|
|
101
|
-
{
|
|
102
|
-
let mesh = tObject as Mesh
|
|
103
|
-
this._rootComponent = new MeshComponent(mesh);
|
|
104
|
-
this.rootComponent.parentActor = this;
|
|
105
|
-
}
|
|
106
|
-
else
|
|
107
|
-
{
|
|
108
|
-
this._rootComponent = new SceneComponent(tObject);
|
|
109
|
-
this.rootComponent.parentActor = this;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
getBoundsCenterPosition(bInWorldSpace = true)
|
|
114
|
-
{
|
|
115
|
-
let ret = new Vector3();
|
|
116
|
-
this.getBounds().getCenter(ret);
|
|
117
|
-
if (!bInWorldSpace)
|
|
118
|
-
{
|
|
119
|
-
return ret.sub(this.getPosition());
|
|
120
|
-
}
|
|
121
|
-
else
|
|
122
|
-
{
|
|
123
|
-
return ret;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
getBoundsTopCenterPosition(bInWorldSpace = true)
|
|
128
|
-
{
|
|
129
|
-
let ret = new Vector3();
|
|
130
|
-
let bounds = this.rootComponent.getBounds();
|
|
131
|
-
bounds.getCenter(ret);
|
|
132
|
-
ret.y = bounds.max.y;
|
|
133
|
-
if (!bInWorldSpace)
|
|
134
|
-
{
|
|
135
|
-
return ret.sub(this.getPosition());
|
|
136
|
-
}
|
|
137
|
-
else
|
|
138
|
-
{
|
|
139
|
-
return ret;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
getBoundsBottomCenterPosition(bInWorldSpace = true)
|
|
144
|
-
{
|
|
145
|
-
let ret = new Vector3();
|
|
146
|
-
let bounds = this.getBounds();
|
|
147
|
-
bounds.getCenter(ret);
|
|
148
|
-
|
|
149
|
-
ret.y = bounds.min.y;
|
|
150
|
-
if (!bInWorldSpace)
|
|
151
|
-
{
|
|
152
|
-
return ret.sub(this.getPosition());
|
|
153
|
-
}
|
|
154
|
-
else
|
|
155
|
-
{
|
|
156
|
-
return ret;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
getBounds()
|
|
161
|
-
{
|
|
162
|
-
return this.rootComponent.getBounds();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
destroy()
|
|
166
|
-
{
|
|
167
|
-
let childActors = this.childActors;
|
|
168
|
-
childActors.forEach((elem) =>
|
|
169
|
-
{
|
|
170
|
-
elem.destroy();
|
|
171
|
-
});
|
|
172
|
-
this.rootComponent.destroy();
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
setVisible(bVisible:boolean)
|
|
176
|
-
{
|
|
177
|
-
this.rootComponent.setVisible(bVisible);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
setLayers(layer:number, bAffectChildActor = true)
|
|
181
|
-
{
|
|
182
|
-
this.rootComponent.setLayers(layer);
|
|
183
|
-
if (bAffectChildActor)
|
|
184
|
-
{
|
|
185
|
-
this.childActors.forEach((child) =>
|
|
186
|
-
{
|
|
187
|
-
child.setLayers(layer, bAffectChildActor);
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
tick(deltaTime:number):void
|
|
194
|
-
{
|
|
195
|
-
super.tick(deltaTime);
|
|
196
|
-
this.rootComponent.tick(deltaTime);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Local Transforms
|
|
200
|
-
// // Position
|
|
201
|
-
getPosition():Vector3
|
|
202
|
-
{
|
|
203
|
-
return this.rootComponent.getPosition();
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
setPosition(position:Vector3):void;
|
|
207
|
-
setPosition(x:number, y:number, z:number):void;
|
|
208
|
-
setPosition(...args:[Vector3] | [number, number, number]):void
|
|
209
|
-
{
|
|
210
|
-
if(args.length === 1)
|
|
211
|
-
{
|
|
212
|
-
this.rootComponent.setPosition(args[0]);
|
|
213
|
-
}
|
|
214
|
-
else
|
|
215
|
-
{
|
|
216
|
-
this.rootComponent.setPosition(args[0],args[1],args[2]);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// // Rotation (euler)
|
|
221
|
-
getRotation():Euler
|
|
222
|
-
{
|
|
223
|
-
return this.rootComponent.getRotation();
|
|
224
|
-
}
|
|
225
|
-
setRotation(rotation:Euler):void;
|
|
226
|
-
setRotation(x:number, y:number, z:number):void;
|
|
227
|
-
setRotation(...args:[Euler]|[x:number, y:number, z:number])
|
|
228
|
-
{
|
|
229
|
-
if(args.length === 1)
|
|
230
|
-
{
|
|
231
|
-
this.rootComponent.setRotation(args[0]);
|
|
232
|
-
}
|
|
233
|
-
else
|
|
234
|
-
{
|
|
235
|
-
this.rootComponent.setRotation(args[0],args[1],args[2]);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// // quat
|
|
240
|
-
getQuaternion():Quaternion
|
|
241
|
-
{
|
|
242
|
-
return this.rootComponent.getQuaternion();
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
setQuaternion(quat:Quaternion):void;
|
|
246
|
-
setQuaternion(x:number, y:number, z:number, w:number):void;
|
|
247
|
-
setQuaternion(...args:[Quaternion]|[x:number, y:number, z:number, w:number])
|
|
248
|
-
{
|
|
249
|
-
if(args.length === 1)
|
|
250
|
-
{
|
|
251
|
-
this.rootComponent.setQuaternion(args[0]);
|
|
252
|
-
}
|
|
253
|
-
else
|
|
254
|
-
{
|
|
255
|
-
this.rootComponent.setQuaternion(args[0],args[1],args[2],args[3]);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// // Scale
|
|
260
|
-
getScale():Vector3
|
|
261
|
-
{
|
|
262
|
-
return this.rootComponent.getScale();
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
setScale(position:Vector3):void;
|
|
266
|
-
setScale(x:number, y:number, z:number):void;
|
|
267
|
-
setScale(...args:[Vector3] | [number, number, number]):void
|
|
268
|
-
{
|
|
269
|
-
if(args.length === 1)
|
|
270
|
-
{
|
|
271
|
-
this.rootComponent.setScale(args[0]);
|
|
272
|
-
}
|
|
273
|
-
else
|
|
274
|
-
{
|
|
275
|
-
this.rootComponent.setScale(args[0],args[1],args[2]);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
// World Transform
|
|
279
|
-
// // Matrix
|
|
280
|
-
getWorldMatrix():Matrix4
|
|
281
|
-
{
|
|
282
|
-
return this.rootComponent.getWorldMatrix();
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
setWorldMatrix(newMatrix:Matrix4):void
|
|
286
|
-
{
|
|
287
|
-
this.rootComponent.setWorldMatrix(newMatrix);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// // WorldPosition
|
|
291
|
-
getWorldPosition():Vector3
|
|
292
|
-
{
|
|
293
|
-
return this.rootComponent.getWorldPosition();
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// setWorldPosition(param1, param2 = undefined, param3 = undefined)
|
|
297
|
-
// {
|
|
298
|
-
|
|
299
|
-
// }
|
|
300
|
-
// // rotation(euler)
|
|
301
|
-
getWorldRotation():Euler
|
|
302
|
-
{
|
|
303
|
-
return this.rootComponent.getWorldRotation();
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// // rotation(quat)
|
|
307
|
-
getWorldQuaternion():Quaternion
|
|
308
|
-
{
|
|
309
|
-
return this.rootComponent.getWorldQuaternion();
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// // Scale
|
|
313
|
-
getWorldScale():Vector3
|
|
314
|
-
{
|
|
315
|
-
return this.rootComponent.getWorldScale();
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
getWorldForwardDirection():Vector3
|
|
319
|
-
{
|
|
320
|
-
return this.rootComponent.getWorldForwardDirection();
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
getWorldUpDirection():Vector3
|
|
324
|
-
{
|
|
325
|
-
return this.rootComponent.getWorldUpDirection();
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
getWorldRightDirection():Vector3
|
|
329
|
-
{
|
|
330
|
-
return this.rootComponent.getWorldRightDirection();
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
addLocalOffset(axis:Vector3, value:number)
|
|
334
|
-
{
|
|
335
|
-
let pos = this.getPosition();
|
|
336
|
-
this.setPosition(pos.x + axis.x * value, pos.y + axis.y * value, pos.z + axis.z * value);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
worldToLocal(vec:Vector3):Vector3
|
|
340
|
-
{
|
|
341
|
-
return this.rootComponent.worldToLocal(vec);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
localToWorld(vec:Vector3):Vector3
|
|
345
|
-
{
|
|
346
|
-
return this.rootComponent.localToWorld(vec);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
getComponents()
|
|
350
|
-
{
|
|
351
|
-
return this.rootComponent.childrenComponents;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
addComponent(newComponent:SceneComponent, attachmentRule:AttachmentRules = AttachmentRules.KeepRelative)
|
|
355
|
-
{
|
|
356
|
-
this.rootComponent.addChildComponent(newComponent, attachmentRule);
|
|
357
|
-
if (this._world)
|
|
358
|
-
{
|
|
359
|
-
newComponent.onAddedToWorld(this._world);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
removeComponent(targetComponent:SceneComponent)
|
|
364
|
-
{
|
|
365
|
-
if (targetComponent === this._rootComponent)
|
|
366
|
-
{
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
this.rootComponent.removeChildComponent(targetComponent);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
clearComponent()
|
|
373
|
-
{
|
|
374
|
-
this.rootComponent.destroyChildren();
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
addChildActor(newActor:Actor, attachmentRule:AttachmentRules = AttachmentRules.KeepWorld)
|
|
378
|
-
{
|
|
379
|
-
if (!(newActor.rootComponent))
|
|
380
|
-
{
|
|
381
|
-
console.error("Actor :: addChildActor : the 'newActor' you want to add has no rootcomponent");
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
if (newActor.parentActor === this)
|
|
385
|
-
{
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
if (attachmentRule === AttachmentRules.KeepRelative)
|
|
389
|
-
{
|
|
390
|
-
this.rootComponent.attachComponent(newActor.rootComponent);
|
|
391
|
-
}
|
|
392
|
-
if (attachmentRule === AttachmentRules.KeepWorld)
|
|
393
|
-
{
|
|
394
|
-
let worldMatrix = newActor.getWorldMatrix();
|
|
395
|
-
this.rootComponent.attachComponent(newActor.rootComponent);
|
|
396
|
-
newActor.setWorldMatrix(worldMatrix);
|
|
397
|
-
}
|
|
398
|
-
if (this._world)
|
|
399
|
-
{
|
|
400
|
-
this._world.viewport.markRenderStateDirty();
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
removeChildActor(target:Actor)
|
|
405
|
-
{
|
|
406
|
-
let worldMatrix = target.getWorldMatrix();
|
|
407
|
-
this.rootComponent.detachComponent(target.rootComponent);
|
|
408
|
-
target.setWorldMatrix(worldMatrix);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
removeFromParent()
|
|
412
|
-
{
|
|
413
|
-
if (this.parentActor)
|
|
414
|
-
{
|
|
415
|
-
this.parentActor.removeChildActor(this);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
onAddedToWorld(world:World)
|
|
420
|
-
{
|
|
421
|
-
this._world = world;
|
|
422
|
-
|
|
423
|
-
this.rootComponent.onAddedToWorld(this._world);
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
this.childActors.forEach((elem) =>
|
|
427
|
-
{
|
|
428
|
-
elem.onAddedToWorld(world);
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
onRemovedFromWorld()
|
|
433
|
-
{
|
|
434
|
-
this._world = null;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
get isHoverEnabled()
|
|
439
|
-
{
|
|
440
|
-
return this.rootComponent.isHoverEnabled;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
set isHoverEnabled(bCanHorver:boolean)
|
|
444
|
-
{
|
|
445
|
-
this.rootComponent.isHoverEnabled = bCanHorver;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
get isClickEnabled()
|
|
449
|
-
{
|
|
450
|
-
return this.rootComponent.isClickEnabled;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
set isClickEnabled(bCanHorver)
|
|
454
|
-
{
|
|
455
|
-
this.rootComponent.isClickEnabled = bCanHorver;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
// hovering begin
|
|
459
|
-
addHoveringBeginEvent(newFunc:(component?:SceneComponent)=>void)
|
|
460
|
-
{
|
|
461
|
-
this.onHoverBeginEvent.push(newFunc);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
removeHoveringBeginEvent(target:(component?:SceneComponent)=>void)
|
|
465
|
-
{
|
|
466
|
-
let index = this.onHoverBeginEvent.indexOf(target);
|
|
467
|
-
if (index >= 0)
|
|
468
|
-
{
|
|
469
|
-
this.onHoverBeginEvent.splice(index, 1);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
clearHoveringBeginEvent()
|
|
474
|
-
{
|
|
475
|
-
this.onHoverBeginEvent = [];
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
onComponentHorveringBegin(component:SceneComponent)
|
|
479
|
-
{
|
|
480
|
-
for (let i = 0; i < this.onHoverBeginEvent.length; ++i)
|
|
481
|
-
{
|
|
482
|
-
this.onHoverBeginEvent[i](component);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
// hovering end
|
|
487
|
-
addHoveringEndEvent(newFunc:(component?:SceneComponent)=>void)
|
|
488
|
-
{
|
|
489
|
-
this.onHoverEndEvent.push(newFunc);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
removeHoveringEndEvent(target:(component?:SceneComponent)=>void)
|
|
493
|
-
{
|
|
494
|
-
let index = this.onHoverEndEvent.indexOf(target);
|
|
495
|
-
if (index >= 0)
|
|
496
|
-
{
|
|
497
|
-
this.onHoverEndEvent.splice(index, 1);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
clearHoveringEndEvent()
|
|
502
|
-
{
|
|
503
|
-
this.onHoverEndEvent = [];
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
onComponentHorveringEnd(component:SceneComponent)
|
|
507
|
-
{
|
|
508
|
-
// console.log("onComponentHorveringEnd", this)
|
|
509
|
-
for (let i = 0; i < this.onHoverEndEvent.length; ++i)
|
|
510
|
-
{
|
|
511
|
-
this.onHoverEndEvent[i](component);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
//click
|
|
516
|
-
addClickEvent(newFunc:(component?:SceneComponent)=>void)
|
|
517
|
-
{
|
|
518
|
-
this.onClickedEvent.push(newFunc);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
removeClickEvent(target:(component?:SceneComponent)=>void)
|
|
522
|
-
{
|
|
523
|
-
let index = this.onClickedEvent.indexOf(target);
|
|
524
|
-
if (index >= 0)
|
|
525
|
-
{
|
|
526
|
-
this.onClickedEvent.splice(index, 1);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
clearClickEvent()
|
|
531
|
-
{
|
|
532
|
-
this.onClickedEvent = [];
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
onComponentClicked(component:SceneComponent)
|
|
536
|
-
{
|
|
537
|
-
//console.log("onComponentClicked", this.Name, component)
|
|
538
|
-
for (let i = 0; i < this.onClickedEvent.length; ++i)
|
|
539
|
-
{
|
|
540
|
-
this.onClickedEvent[i](component);
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
// double click
|
|
545
|
-
addDoubleClickEvent(newFunc:(component?:SceneComponent)=>void)
|
|
546
|
-
{
|
|
547
|
-
this.onDoubleClickedEvent.push(newFunc);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
removeDoubleClickEvent(target:(component?:SceneComponent)=>void)
|
|
551
|
-
{
|
|
552
|
-
let index = this.onClickedEvent.indexOf(target);
|
|
553
|
-
if (index >= 0)
|
|
554
|
-
{
|
|
555
|
-
this.onDoubleClickedEvent.splice(index, 1);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
onComponentDoubleClicked(component:SceneComponent)
|
|
559
|
-
{
|
|
560
|
-
//console.log("onComponentClicked", this.Name, component)
|
|
561
|
-
for (let i = 0; i < this.onDoubleClickedEvent.length; ++i)
|
|
562
|
-
{
|
|
563
|
-
this.onDoubleClickedEvent[i](component);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
clearDoubleClickEvent()
|
|
568
|
-
{
|
|
569
|
-
this.onDoubleClickedEvent = [];
|
|
570
|
-
}
|
|
571
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {ColorRepresentation} from "three";
|
|
3
|
-
import {Actor} from "../../Actor";
|
|
4
|
-
import {DirectionalLightComponent} from "../../Components/Light/DirectionalLight/DirectionalLightComponent";
|
|
5
|
-
|
|
6
|
-
export class DirectionalLightActor extends Actor
|
|
7
|
-
{
|
|
8
|
-
protected lightComponent : DirectionalLightComponent
|
|
9
|
-
constructor(color:ColorRepresentation = 0xffffff, intensity:number = 1)
|
|
10
|
-
{
|
|
11
|
-
super();
|
|
12
|
-
this.lightComponent = new DirectionalLightComponent(color, intensity)
|
|
13
|
-
this.rootComponent = this.lightComponent
|
|
14
|
-
this.lightComponent.castShadow = true
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {Material, MeshBasicMaterial} from "three";
|
|
3
|
-
import {Actor} from "../../Actor";
|
|
4
|
-
import {BoxComponent} from "../../Components/Mesh/Shape/BoxComponent";
|
|
5
|
-
|
|
6
|
-
export class BoxActor extends Actor
|
|
7
|
-
{
|
|
8
|
-
constructor(
|
|
9
|
-
width :number = 1,
|
|
10
|
-
height :number = 1,
|
|
11
|
-
depth :number = 1,
|
|
12
|
-
widthSegments :number = 1,
|
|
13
|
-
heightSegments:number = 1,
|
|
14
|
-
depthSegments :number = 1,
|
|
15
|
-
material :Material = new MeshBasicMaterial())
|
|
16
|
-
{
|
|
17
|
-
super();
|
|
18
|
-
this.addComponent(new BoxComponent(width, height, depth, widthSegments,heightSegments,depthSegments, material))
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// import {CurveMaterial, LYBaseActor, LYCurveComponent} from "../../../../LYCustomFrame";
|
|
2
|
-
// import {Vector3} from "three";
|
|
3
|
-
// import { MeshLineMaterial } from 'three.meshline';
|
|
4
|
-
// export class LYCurveActor extends LYBaseActor
|
|
5
|
-
// {
|
|
6
|
-
// constructor(points:Vector3[] = [], material:MeshLineMaterial = CurveMaterial, tension:number = 0)
|
|
7
|
-
// {
|
|
8
|
-
// super();
|
|
9
|
-
// this.addComponent(new LYCurveComponent(points, material, tension))
|
|
10
|
-
// }
|
|
11
|
-
// }
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {Material, MeshBasicMaterial} from "three";
|
|
3
|
-
import {Actor} from "../../Actor";
|
|
4
|
-
import {PlaneComponent} from "../../Components/Mesh/Shape/PlaneComponent";
|
|
5
|
-
|
|
6
|
-
export class PlaneActor extends Actor
|
|
7
|
-
{
|
|
8
|
-
get planeComponent(): PlaneComponent | null
|
|
9
|
-
{
|
|
10
|
-
return this._planeComponent;
|
|
11
|
-
}
|
|
12
|
-
private _planeComponent: PlaneComponent|null;
|
|
13
|
-
constructor(width:number, height:number, material:Material = new MeshBasicMaterial(), widthSegments:number = 1, heightSegments:number = 1)
|
|
14
|
-
{
|
|
15
|
-
super();
|
|
16
|
-
this._planeComponent = new PlaneComponent(width, height, material, widthSegments,heightSegments )
|
|
17
|
-
this._planeComponent.setRotation(Math.PI * 0.5 * -1 , 0,0)
|
|
18
|
-
this.addComponent(this._planeComponent)
|
|
19
|
-
this._planeComponent.receiveShadow = true
|
|
20
|
-
}
|
|
21
|
-
destroy()
|
|
22
|
-
{
|
|
23
|
-
this._planeComponent?.destroy()
|
|
24
|
-
this._planeComponent = null
|
|
25
|
-
super.destroy();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
// }
|