void
renderTextureMesh(RenderState renderState, Int16List ixList, Float32List vxList)
Source
void renderTextureMesh(
RenderState renderState,
Int16List ixList, Float32List vxList) {
var alpha = renderState.globalAlpha;
var matrix = renderState.globalMatrix;
var ixListCount = ixList.length;
var vxListCount = vxList.length >> 2;
// check buffer sizes and flush if necessary
var ixData = renderBufferIndex.data;
var ixPosition = renderBufferIndex.position;
if (ixPosition + ixListCount >= ixData.length) flush();
var vxData = renderBufferVertex.data;
var vxPosition = renderBufferVertex.position;
if (vxPosition + vxListCount * 5 >= vxData.length) flush();
var ixIndex = renderBufferIndex.position;
var vxIndex = renderBufferVertex.position;
var vxCount = renderBufferVertex.count;
// copy index list
for (var i = 0; i < ixListCount; i++) {
ixData[ixIndex + i] = vxCount + ixList[i];
}
renderBufferIndex.position += ixListCount;
renderBufferIndex.count += ixListCount;
// copy vertex list
var ma = matrix.a;
var mb = matrix.b;
var mc = matrix.c;
var md = matrix.d;
var mx = matrix.tx;
var my = matrix.ty;
for (var i = 0, o = 0; i < vxListCount; i++, o += 4) {
num x = vxList[o + 0];
num y = vxList[o + 1];
vxData[vxIndex + 0] = mx + ma * x + mc * y;
vxData[vxIndex + 1] = my + mb * x + md * y;
vxData[vxIndex + 2] = vxList[o + 2];
vxData[vxIndex + 3] = vxList[o + 3];
vxData[vxIndex + 4] = alpha;
vxIndex += 5;
}
renderBufferVertex.position += vxListCount * 5;
renderBufferVertex.count += vxListCount;
}