-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstance.ts
28 lines (25 loc) · 919 Bytes
/
instance.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
namespace threed {
export class Instance {
public model: Model;
public color: number;
public position: Vector3;
public rotation: Vector3;
public scale: Vector3;
public transform: Matrix4x4;
constructor(model: Model, color: number, position: Vector3, rotation: Vector3, scale: Vector3) {
this.model = model;
this.color = color;
this.position = position;
this.rotation = rotation;
this.scale = scale;
this.update();
}
public update() {
this.transform = Matrix4x4.Multiply(
Matrix4x4.TranslationMatrix(this.position),
Matrix4x4.Multiply(
Matrix4x4.RotationMatrixFromEulerAngles(this.rotation),
Matrix4x4.NonUniformScalingMatrix(this.scale)));
}
}
}