Skip to content

Commit 5ac6212

Browse files
author
David Gillen
committed
assign unique variable for vertex attribute indexing (allows single buffer)
1 parent 10fefbd commit 5ac6212

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/easeljs/display/StageGL.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,29 +2807,33 @@ this.createjs = this.createjs||{};
28072807
// These must be calculated here else a forced draw might happen after they're set
28082808
var offV1 = this._batchVertexCount; // offset for 1 component vectors
28092809
var offV2 = offV1*2; // offset for 2 component vectors
2810+
var vtxOff = offV2;
2811+
var uvOff = offV2;
2812+
var aOff = offV1;
2813+
var texOff = offV1;
28102814

28112815
//DHG: See Matrix2D.transformPoint for why this math specifically
28122816
// apply vertices
2813-
vertices[offV2] = subL *iMtx.a + subT *iMtx.c +iMtx.tx; vertices[offV2+1] = subL *iMtx.b + subT *iMtx.d +iMtx.ty;
2814-
vertices[offV2+2] = subL *iMtx.a + subB *iMtx.c +iMtx.tx; vertices[offV2+3] = subL *iMtx.b + subB *iMtx.d +iMtx.ty;
2815-
vertices[offV2+4] = subR *iMtx.a + subT *iMtx.c +iMtx.tx; vertices[offV2+5] = subR *iMtx.b + subT *iMtx.d +iMtx.ty;
2816-
vertices[offV2+6] = vertices[offV2+2]; vertices[offV2+7] = vertices[offV2+3];
2817-
vertices[offV2+8] = vertices[offV2+4]; vertices[offV2+9] = vertices[offV2+5];
2818-
vertices[offV2+10] = subR *iMtx.a + subB *iMtx.c +iMtx.tx; vertices[offV2+11] = subR *iMtx.b + subB *iMtx.d +iMtx.ty;
2817+
vertices[vtxOff] = subL *iMtx.a + subT *iMtx.c +iMtx.tx; vertices[vtxOff+1] = subL *iMtx.b + subT *iMtx.d +iMtx.ty;
2818+
vertices[vtxOff+2] = subL *iMtx.a + subB *iMtx.c +iMtx.tx; vertices[vtxOff+3] = subL *iMtx.b + subB *iMtx.d +iMtx.ty;
2819+
vertices[vtxOff+4] = subR *iMtx.a + subT *iMtx.c +iMtx.tx; vertices[vtxOff+5] = subR *iMtx.b + subT *iMtx.d +iMtx.ty;
2820+
vertices[vtxOff+6] = vertices[vtxOff+2]; vertices[vtxOff+7] = vertices[vtxOff+3];
2821+
vertices[vtxOff+8] = vertices[vtxOff+4]; vertices[vtxOff+9] = vertices[vtxOff+5];
2822+
vertices[vtxOff+10] = subR *iMtx.a + subB *iMtx.c +iMtx.tx; vertices[vtxOff+11] = subR *iMtx.b + subB *iMtx.d +iMtx.ty;
28192823

28202824
// apply uvs
2821-
uvs[offV2] = uvRect.l; uvs[offV2+1] = uvRect.t;
2822-
uvs[offV2+2] = uvRect.l; uvs[offV2+3] = uvRect.b;
2823-
uvs[offV2+4] = uvRect.r; uvs[offV2+5] = uvRect.t;
2824-
uvs[offV2+6] = uvRect.l; uvs[offV2+7] = uvRect.b;
2825-
uvs[offV2+8] = uvRect.r; uvs[offV2+9] = uvRect.t;
2826-
uvs[offV2+10] = uvRect.r; uvs[offV2+11] = uvRect.b;
2825+
uvs[uvOff] = uvRect.l; uvs[uvOff+1] = uvRect.t;
2826+
uvs[uvOff+2] = uvRect.l; uvs[uvOff+3] = uvRect.b;
2827+
uvs[uvOff+4] = uvRect.r; uvs[uvOff+5] = uvRect.t;
2828+
uvs[uvOff+6] = uvRect.l; uvs[uvOff+7] = uvRect.b;
2829+
uvs[uvOff+8] = uvRect.r; uvs[uvOff+9] = uvRect.t;
2830+
uvs[uvOff+10] = uvRect.r; uvs[uvOff+11] = uvRect.b;
28272831

28282832
// apply texture
2829-
texI[offV1] = texI[offV1+1] = texI[offV1+2] = texI[offV1+3] = texI[offV1+4] = texI[offV1+5] = texIndex;
2833+
texI[texOff] = texI[texOff+1] = texI[texOff+2] = texI[texOff+3] = texI[texOff+4] = texI[texOff+5] = texIndex;
28302834

28312835
// apply alpha
2832-
alphas[offV1] = alphas[offV1+1] = alphas[offV1+2] = alphas[offV1+3] = alphas[offV1+4] = alphas[offV1+5] = itemAlpha * concatAlpha;
2836+
alphas[aOff] = alphas[aOff+1] = alphas[aOff+2] = alphas[aOff+3] = alphas[aOff+4] = alphas[aOff+5] = itemAlpha * concatAlpha;
28332837

28342838
this._batchVertexCount += StageGL.INDICIES_PER_CARD;
28352839

0 commit comments

Comments
 (0)