/
githubmirror
/
pixijs
Обзор
Документация
Войти
/
githubmirror
/
pixijs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
src/rendering/batcher/shared/BatchGeometry.ts
66 строк
2 KB
Zyie
chore: add standard/advanced tags to documentation (#11448)
03 июн 2025, 10:12
Не верифицирован
03 июн 2025, 10:12
7d91234
Код
Авторство
О чём код?
import { Buffer } from '../../renderers/shared/buffer/Buffer'; import { BufferUsage } from '../../renderers/shared/buffer/const'; import { Geometry } from '../../renderers/shared/geometry/Geometry'; const placeHolderBufferData = new Float32Array(1); const placeHolderIndexData = new Uint32Array(1); /** * This class represents a geometry used for batching in the rendering system. * It defines the structure of vertex attributes and index buffers for batched rendering. * @category rendering * @advanced */ export class BatchGeometry extends Geometry { constructor() { const vertexSize = 6; const attributeBuffer = new Buffer({ data: placeHolderBufferData, label: 'attribute-batch-buffer', usage: BufferUsage.VERTEX | BufferUsage.COPY_DST, shrinkToFit: false, }); const indexBuffer = new Buffer({ data: placeHolderIndexData, label: 'index-batch-buffer', usage: BufferUsage.INDEX | BufferUsage.COPY_DST, // | BufferUsage.STATIC, shrinkToFit: false, }); const stride = vertexSize * 4; super({ attributes: { aPosition: { buffer: attributeBuffer, format: 'float32x2', stride, offset: 0, }, aUV: { buffer: attributeBuffer, format: 'float32x2', stride, offset: 2 * 4, }, aColor: { buffer: attributeBuffer, format: 'unorm8x4', stride, offset: 4 * 4, }, aTextureIdAndRound: { buffer: attributeBuffer, format: 'uint16x2', stride, offset: 5 * 4, }, }, indexBuffer }); } }