webgl/public/gl/core/Entity.js
Tyler Murphy 30cf48cd70 cube
2023-01-18 22:43:02 -05:00

25 lines
No EOL
530 B
JavaScript

import { Vec3 } from '../math/Vec3.js'
import { Mat4 } from '../math/Mat4.js'
export class Entity {
static #id = 0
constructor(mesh) {
this.mesh = mesh
this.position = new Vec3()
this.rotation = new Vec3()
this.scale = new Vec3(1, 1, 1)
this.id = Entity.#id
Entity.#id++
}
tran() {
return new Mat4()
.identity()
.pos(this.position)
.rot(this.rotation.clone().multS(Math.PI/180))
.scale(this.scale)
}
}