mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
31 lines
665 B
JavaScript
31 lines
665 B
JavaScript
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
|
|
|
import gfx from '../../gfx';
|
|
|
|
export default class InputAssembler {
|
|
constructor(vb, ib, pt = gfx.PT_TRIANGLES) {
|
|
this._vertexBuffer = vb;
|
|
this._indexBuffer = ib;
|
|
this._primitiveType = pt;
|
|
this._start = 0;
|
|
this._count = -1;
|
|
|
|
// TODO: instancing data
|
|
// this._stream = 0;
|
|
}
|
|
|
|
/**
|
|
* @property {Number} count The number of indices or vertices to dispatch in the draw call.
|
|
*/
|
|
get count() {
|
|
if (this._count !== -1) {
|
|
return this._count;
|
|
}
|
|
|
|
if (this._indexBuffer) {
|
|
return this._indexBuffer.count;
|
|
}
|
|
|
|
return this._vertexBuffer.count;
|
|
}
|
|
} |