-
Notifications
You must be signed in to change notification settings - Fork 46
/
container.ts
55 lines (43 loc) · 1.3 KB
/
container.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { Container } from '@pixi/display';
import { ObservableQuaternion } from "./transform/observable-quaternion"
import { Transform3D } from "./transform/transform"
import { ObservablePoint3D } from "./transform/observable-point"
/**
* A container represents a collection of 3D objects.
*/
export class Container3D extends Container {
transform = new Transform3D()
set position(value: ObservablePoint3D) {
this.transform.position.copyFrom(value)
}
get position(): ObservablePoint3D {
return this.transform.position
}
set scale(value: ObservablePoint3D) {
this.transform.scale.copyFrom(value)
}
get scale(): ObservablePoint3D {
return this.transform.scale
}
set rotationQuaternion(value: ObservableQuaternion) {
this.transform.rotationQuaternion.copyFrom(value)
}
/** The quaternion rotation of the object. */
get rotationQuaternion(): ObservableQuaternion {
return this.transform.rotationQuaternion
}
/** The position of the object on the z axis relative to the local
* coordinates of the parent. */
get z() {
return this.transform.position.z
}
set z(value: number) {
this.transform.position.z = value
}
get localTransform() {
return this.transform.localTransform
}
get worldTransform() {
return this.transform.worldTransform
}
}