UNPKG

the-world-engine

Version:

three.js based, unity like game engine for browser

40 lines 895 B
export class TransformMatrixProcessor { cr; _r; dr; constructor() { this.cr = []; this._r = new Set; this.dr = new Set; } pr() { const e = this._r; this._r = this.dr; this.dr = e; } enqueueTransformToUpdate(e) { if (e.isRegisteredToProcessor) return; e.isRegisteredToProcessor = true; this.cr.push(e); } enqueueRenderObject(e) { this.dr.add(e); } dequeueRenderObject(e) { this.dr.delete(e); } flush() { this._r.clear(); } update() { const e = this.cr; for (let t = 0; t < e.length; ++t) { const r = e[t]; r.tryUpdateWorldMatrixRecursivelyFromThisToChildren(); r.isRegisteredToProcessor = false; } this.cr.length = 0; this.pr(); return this._r; } }