Skip to content

Commit 7f4d11d

Browse files
author
David Gillen
committed
internal naming cleanup
1 parent 5ac6212 commit 7f4d11d

File tree

1 file changed

+30
-40
lines changed

1 file changed

+30
-40
lines changed

src/easeljs/display/StageGL.js

Lines changed: 30 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,13 @@ this.createjs = this.createjs||{};
312312
this._vertices = null;
313313

314314
/**
315-
* The WebGL buffer attached to {{#crossLink "StageGL/_vertices:property"}}{{/crossLink}}.
316-
* @property _vertexPositionBuffer
315+
* The WebGL vertex attribute buffer attached to {{#crossLink "StageGL/_vertices:property"}}{{/crossLink}}.
316+
* @property _vertexPositionAttribute
317317
* @protected
318318
* @type {WebGLBuffer}
319319
* @default null
320320
*/
321-
this._vertexPositionBuffer = null;
321+
this._vertexPositionAttribute = null;
322322

323323
/**
324324
* The vertex UV data for the current draw call.
@@ -330,13 +330,13 @@ this.createjs = this.createjs||{};
330330
this._uvs = null;
331331

332332
/**
333-
* The WebGL buffer attached to {{#crossLink "StageGL/_uvs:property"}}{{/crossLink}}.
334-
* @property _uvPositionBuffer
333+
* The WebGL vertex attribute buffer attached to {{#crossLink "StageGL/_uvs:property"}}{{/crossLink}}.
334+
* @property _uvPositionAttribute
335335
* @protected
336336
* @type {WebGLBuffer}
337337
* @default null
338338
*/
339-
this._uvPositionBuffer = null;
339+
this._uvPositionAttribute = null;
340340

341341
/**
342342
* The vertex indices data for the current draw call.
@@ -348,13 +348,13 @@ this.createjs = this.createjs||{};
348348
this._indices = null;
349349

350350
/**
351-
* The WebGL buffer attached to {{#crossLink "StageGL/_indices:property"}}{{/crossLink}}.
352-
* @property _textureIndexBuffer
351+
* The WebGL vertex attribute buffer attached to {{#crossLink "StageGL/_indices:property"}}{{/crossLink}}.
352+
* @property _textureIndexAttribute
353353
* @protected
354354
* @type {WebGLBuffer}
355355
* @default null
356356
*/
357-
this._textureIndexBuffer = null;
357+
this._textureIndexAttribute = null;
358358

359359
/**
360360
* The vertices data for the current draw call.
@@ -366,13 +366,13 @@ this.createjs = this.createjs||{};
366366
this._alphas = null;
367367

368368
/**
369-
* The WebGL buffer attached to {{#crossLink "StageGL/_alphas:property"}}{{/crossLink}}.
370-
* @property _alphaBuffer
369+
* The WebGL vertex attribute buffer attached to {{#crossLink "StageGL/_alphas:property"}}{{/crossLink}}.
370+
* @property _alphaAttribute
371371
* @protected
372372
* @type {WebGLBuffer}
373373
* @default null
374374
*/
375-
this._alphaBuffer = null;
375+
this._alphaAttribute = null;
376376

377377
/**
378378
* One of the major render buffers used in composite blending drawing. Do not expect this to always be the same object.
@@ -2043,8 +2043,8 @@ this.createjs = this.createjs||{};
20432043

20442044
// get the places in memory the shader is stored so we can feed information into them
20452045
// then save it off on the shader because it's so tied to the shader itself
2046-
shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "vertexPosition");
2047-
gl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute);
2046+
shaderProgram.positionAttribute = gl.getAttribLocation(shaderProgram, "vertexPosition");
2047+
gl.enableVertexAttribArray(shaderProgram.positionAttribute);
20482048

20492049
shaderProgram.uvPositionAttribute = gl.getAttribLocation(shaderProgram, "uvPosition");
20502050
gl.enableVertexAttribArray(shaderProgram.uvPositionAttribute);
@@ -2153,49 +2153,39 @@ this.createjs = this.createjs||{};
21532153
// vertexData[i+4] = 0;
21542154
// vertexData[i+5] = 1;
21552155
// }
2156-
// vertexBuffer.itemSize = groupSize;
2157-
// vertexBuffer.numItems = groupCount;
21582156
// TODO benchmark and test using unified buffer
21592157

21602158
// the actual position information
2161-
var vertexPositionBuffer = this._vertexPositionBuffer = gl.createBuffer();
2159+
var vertexPositionBuffer = this._vertexPositionAttribute = gl.createBuffer();
21622160
gl.bindBuffer(gl.ARRAY_BUFFER, vertexPositionBuffer);
21632161
groupSize = 2;
21642162
var vertices = this._vertices = new Float32Array(groupCount * groupSize);
21652163
for (i=0, l=vertices.length; i<l; i+=groupSize) { vertices[i] = vertices[i+1] = 0; }
21662164
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.DYNAMIC_DRAW);
2167-
vertexPositionBuffer.itemSize = groupSize;
2168-
vertexPositionBuffer.numItems = groupCount;
21692165

21702166
// where on the texture it gets its information
2171-
var uvPositionBuffer = this._uvPositionBuffer = gl.createBuffer();
2167+
var uvPositionBuffer = this._uvPositionAttribute = gl.createBuffer();
21722168
gl.bindBuffer(gl.ARRAY_BUFFER, uvPositionBuffer);
21732169
groupSize = 2;
21742170
var uvs = this._uvs = new Float32Array(groupCount * groupSize);
21752171
for (i=0, l=uvs.length; i<l; i+=groupSize) { uvs[i] = uvs[i+1] = 0; }
21762172
gl.bufferData(gl.ARRAY_BUFFER, uvs, gl.DYNAMIC_DRAW);
2177-
uvPositionBuffer.itemSize = groupSize;
2178-
uvPositionBuffer.numItems = groupCount;
21792173

21802174
// what texture it should use
2181-
var textureIndexBuffer = this._textureIndexBuffer = gl.createBuffer();
2175+
var textureIndexBuffer = this._textureIndexAttribute = gl.createBuffer();
21822176
gl.bindBuffer(gl.ARRAY_BUFFER, textureIndexBuffer);
21832177
groupSize = 1;
21842178
var indices = this._indices = new Float32Array(groupCount * groupSize);
21852179
for (i=0, l=indices.length; i<l; i++) { indices[i] = 0; }
21862180
gl.bufferData(gl.ARRAY_BUFFER, indices, gl.DYNAMIC_DRAW);
2187-
textureIndexBuffer.itemSize = groupSize;
2188-
textureIndexBuffer.numItems = groupCount;
21892181

21902182
// what alpha it should have
2191-
var alphaBuffer = this._alphaBuffer = gl.createBuffer();
2183+
var alphaBuffer = this._alphaAttribute = gl.createBuffer();
21922184
gl.bindBuffer(gl.ARRAY_BUFFER, alphaBuffer);
21932185
groupSize = 1;
21942186
var alphas = this._alphas = new Float32Array(groupCount * groupSize);
21952187
for (i=0, l=alphas.length; i<l; i++) { alphas[i] = 1; }
21962188
gl.bufferData(gl.ARRAY_BUFFER, alphas, gl.DYNAMIC_DRAW);
2197-
alphaBuffer.itemSize = groupSize;
2198-
alphaBuffer.numItems = groupCount;
21992189
};
22002190

22012191
/**
@@ -2903,27 +2893,27 @@ this.createjs = this.createjs||{};
29032893
console.log("Batch["+ this._drawID +":"+ this._batchID +"] : "+ this.batchReason);
29042894
}
29052895
var shaderProgram = this._activeShader;
2906-
var vertexPositionBuffer = this._vertexPositionBuffer;
2907-
var textureIndexBuffer = this._textureIndexBuffer;
2908-
var uvPositionBuffer = this._uvPositionBuffer;
2909-
var alphaBuffer = this._alphaBuffer;
2896+
var vertexPositionBuffer = this._vertexPositionAttribute;
2897+
var textureIndexBuffer = this._textureIndexAttribute;
2898+
var uvPositionBuffer = this._uvPositionAttribute;
2899+
var alphaBuffer = this._alphaAttribute;
29102900

29112901
gl.useProgram(shaderProgram);
29122902

29132903
gl.bindBuffer(gl.ARRAY_BUFFER, vertexPositionBuffer);
2914-
gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, vertexPositionBuffer.itemSize, gl.FLOAT, false, 0, 0);
2904+
gl.vertexAttribPointer(shaderProgram.positionAttribute, 2, gl.FLOAT, false, 0, 0);
29152905
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this._vertices);
29162906

29172907
gl.bindBuffer(gl.ARRAY_BUFFER, textureIndexBuffer);
2918-
gl.vertexAttribPointer(shaderProgram.textureIndexAttribute, textureIndexBuffer.itemSize, gl.FLOAT, false, 0, 0);
2908+
gl.vertexAttribPointer(shaderProgram.textureIndexAttribute, 1, gl.FLOAT, false, 0, 0);
29192909
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this._indices);
29202910

29212911
gl.bindBuffer(gl.ARRAY_BUFFER, uvPositionBuffer);
2922-
gl.vertexAttribPointer(shaderProgram.uvPositionAttribute, uvPositionBuffer.itemSize, gl.FLOAT, false, 0, 0);
2912+
gl.vertexAttribPointer(shaderProgram.uvPositionAttribute, 2, gl.FLOAT, false, 0, 0);
29232913
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this._uvs);
29242914

29252915
gl.bindBuffer(gl.ARRAY_BUFFER, alphaBuffer);
2926-
gl.vertexAttribPointer(shaderProgram.alphaAttribute, alphaBuffer.itemSize, gl.FLOAT, false, 0, 0);
2916+
gl.vertexAttribPointer(shaderProgram.alphaAttribute, 1, gl.FLOAT, false, 0, 0);
29272917
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this._alphas);
29282918

29292919
gl.uniformMatrix4fv(shaderProgram.pMatrixUniform, gl.FALSE, this._projectionMatrix);
@@ -2952,16 +2942,16 @@ this.createjs = this.createjs||{};
29522942
console.log("Cover["+ this._drawID +":"+ this._batchID +"] : "+ this.batchReason);
29532943
}
29542944
var shaderProgram = this._activeShader;
2955-
var vertexPositionBuffer = this._vertexPositionBuffer;
2956-
var uvPositionBuffer = this._uvPositionBuffer;
2945+
var vertexPositionBuffer = this._vertexPositionAttribute;
2946+
var uvPositionBuffer = this._uvPositionAttribute;
29572947

29582948
gl.useProgram(shaderProgram);
29592949

29602950
gl.bindBuffer(gl.ARRAY_BUFFER, vertexPositionBuffer);
2961-
gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, vertexPositionBuffer.itemSize, gl.FLOAT, false, 0, 0);
2951+
gl.vertexAttribPointer(shaderProgram.positionAttribute, 2, gl.FLOAT, false, 0, 0);
29622952
gl.bufferSubData(gl.ARRAY_BUFFER, 0, StageGL.COVER_VERT);
29632953
gl.bindBuffer(gl.ARRAY_BUFFER, uvPositionBuffer);
2964-
gl.vertexAttribPointer(shaderProgram.uvPositionAttribute, uvPositionBuffer.itemSize, gl.FLOAT, false, 0, 0);
2954+
gl.vertexAttribPointer(shaderProgram.uvPositionAttribute, 2, gl.FLOAT, false, 0, 0);
29652955
gl.bufferSubData(gl.ARRAY_BUFFER, 0, StageGL.COVER_UV);
29662956

29672957
gl.uniform1i(shaderProgram.samplerUniform, 0);

0 commit comments

Comments
 (0)