Archived
Private
Public Access
1
0

Initial commit

This commit is contained in:
2022-09-04 12:45:01 +02:00
commit f4a01d6a69
11601 changed files with 4206660 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
namespace TSE {
export class Transform {
public position: Vector3 = Vector3.zero;
public rotation: Vector3 = Vector3.zero;
public scale: Vector3 = Vector3.one;
public copyFrom(transform: Transform): void {
this.position.copyFrom(transform.position);
this.rotation.copyFrom(transform.rotation);
this.scale.copyFrom(transform.scale);
}
public get transformationMatrix(): Matrix4x4 {
let translation = Matrix4x4.translation(this.position);
let rotation = Matrix4x4.rotationXYZ(this.rotation.x, this.rotation.y, this.rotation.z);
let scale = Matrix4x4.scale(this.scale);
return Matrix4x4.multiply3(translation, rotation, scale);
}
public setFromJson(json: any): void {
if (json.position !== undefined) this.position.setFromJson(json.position);
if (json.rotation !== undefined) this.rotation.setFromJson(json.rotation);
if (json.scale !== undefined) this.scale.setFromJson(json.scale);
}
}
}