UNPKG

@awayjs/stage

Version:
50 lines (49 loc) 1.43 kB
/** * * @class away.pool.ProgramDataBase */ var ProgramData = /** @class */ (function () { function ProgramData(pool, context, vertexString, fragmentString) { this.usages = 0; /** * Dispose time, used in ProgramDataPool to avoid recreatings */ this.disposedAt = -1; this.disposed = false; this._pool = pool; this.stage = context; this.vertexString = vertexString; this.fragmentString = fragmentString; this.stage.registerProgram(this); } /** * Lighed dispose. Pushs prog to pool for waiting time to die or mercy */ ProgramData.prototype.dispose = function () { this.usages--; if (!this.usages) { this._pool.disposeItem(this.vertexString + this.fragmentString); } }; /** * Dispose prog and internal prog completely */ ProgramData.prototype.disposeFinaly = function () { if (this.stage) { this.stage.unRegisterProgram(this); } if (this.program) { this.program.dispose(); } this.program = null; this.usages = 0; this.vertexString = undefined; this.fragmentString = undefined; this.disposedAt = -1; this.stage = undefined; this.disposed = true; }; ProgramData.PROGRAMDATA_ID_COUNT = 0; return ProgramData; }()); export { ProgramData };