UNPKG

laya-coreui-es

Version:

laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改

37 lines (36 loc) 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BufferStateBase = void 0; const LayaGL_1 = require("../layagl/LayaGL"); class BufferStateBase { constructor() { this._nativeVertexArrayObject = LayaGL_1.LayaGL.layaGPUInstance.createVertexArray(); } bind() { if (BufferStateBase._curBindedBufferState !== this) { LayaGL_1.LayaGL.layaGPUInstance.bindVertexArray(this._nativeVertexArrayObject); BufferStateBase._curBindedBufferState = this; } } unBind() { if (BufferStateBase._curBindedBufferState === this) { LayaGL_1.LayaGL.layaGPUInstance.bindVertexArray(null); BufferStateBase._curBindedBufferState = null; } else { throw "BufferState: must call bind() function first."; } } destroy() { LayaGL_1.LayaGL.layaGPUInstance.deleteVertexArray(this._nativeVertexArrayObject); } bindForNative() { LayaGL_1.LayaGL.instance.bindVertexArray(this._nativeVertexArrayObject); BufferStateBase._curBindedBufferState = this; } unBindForNative() { LayaGL_1.LayaGL.instance.bindVertexArray(null); BufferStateBase._curBindedBufferState = null; } } exports.BufferStateBase = BufferStateBase;