diff --git a/src/core/sprites/webgl/SpriteBatchRenderer.js b/src/core/sprites/webgl/SpriteBatchRenderer.js index ceb41f5..82a2318 100644 --- a/src/core/sprites/webgl/SpriteBatchRenderer.js +++ b/src/core/sprites/webgl/SpriteBatchRenderer.js @@ -28,7 +28,7 @@ * * @member {number} */ - this.vertSize = 12; + this.vertSize = 10; /** * @@ -277,21 +277,15 @@ vertices[index++] = sprite.scale.x; vertices[index++] = sprite.scale.y; - //skew - vertices[index++] = sprite.skew.x; - vertices[index++] = sprite.skew.y; - //rotation vertices[index++] = sprite.rotation; // uv vertices[index++] = uvs.x0; vertices[index++] = uvs.y1; - // color vertices[index++] = sprite.alpha; - // ---- // xy vertices[index++] = w0; @@ -304,21 +298,15 @@ vertices[index++] = sprite.scale.x; vertices[index++] = sprite.scale.y; - //skew - vertices[index++] = sprite.skew.x; - vertices[index++] = sprite.skew.y; - //rotation vertices[index++] = sprite.rotation; // uv vertices[index++] = uvs.x1; vertices[index++] = uvs.y1; - // color vertices[index++] = sprite.alpha; - // ---- // xy vertices[index++] = w0; @@ -331,21 +319,17 @@ vertices[index++] = sprite.scale.x; vertices[index++] = sprite.scale.y; - //skew - vertices[index++] = sprite.skew.x; - vertices[index++] = sprite.skew.y; - //rotation vertices[index++] = sprite.rotation; // uv vertices[index++] = uvs.x2; vertices[index++] = uvs.y2; - // color vertices[index++] = sprite.alpha; - // ---- + + // xy vertices[index++] = w1; @@ -358,17 +342,12 @@ vertices[index++] = sprite.scale.x; vertices[index++] = sprite.scale.y; - //skew - vertices[index++] = sprite.skew.x; - vertices[index++] = sprite.skew.y; - //rotation vertices[index++] = sprite.rotation; // uv vertices[index++] = uvs.x3; vertices[index++] = uvs.y3; - // color vertices[index++] = sprite.alpha; @@ -459,8 +438,7 @@ gl.vertexAttribPointer(this.shader.attributes.aPositionCoord, 2, gl.FLOAT, false, stride, 5 * 4); gl.vertexAttribPointer(this.shader.attributes.aScale, 2, gl.FLOAT, false, stride, 7 * 4); - gl.vertexAttribPointer(this.shader.attributes.aSkew, 2, gl.FLOAT, false, stride, 9 * 4); - gl.vertexAttribPointer(this.shader.attributes.aRotation, 1, gl.FLOAT, false, stride, 11 * 4); + gl.vertexAttribPointer(this.shader.attributes.aRotation, 1, gl.FLOAT, false, stride, 9 * 4); }; /** diff --git a/src/core/sprites/webgl/SpriteBatchRenderer.js b/src/core/sprites/webgl/SpriteBatchRenderer.js index ceb41f5..82a2318 100644 --- a/src/core/sprites/webgl/SpriteBatchRenderer.js +++ b/src/core/sprites/webgl/SpriteBatchRenderer.js @@ -28,7 +28,7 @@ * * @member {number} */ - this.vertSize = 12; + this.vertSize = 10; /** * @@ -277,21 +277,15 @@ vertices[index++] = sprite.scale.x; vertices[index++] = sprite.scale.y; - //skew - vertices[index++] = sprite.skew.x; - vertices[index++] = sprite.skew.y; - //rotation vertices[index++] = sprite.rotation; // uv vertices[index++] = uvs.x0; vertices[index++] = uvs.y1; - // color vertices[index++] = sprite.alpha; - // ---- // xy vertices[index++] = w0; @@ -304,21 +298,15 @@ vertices[index++] = sprite.scale.x; vertices[index++] = sprite.scale.y; - //skew - vertices[index++] = sprite.skew.x; - vertices[index++] = sprite.skew.y; - //rotation vertices[index++] = sprite.rotation; // uv vertices[index++] = uvs.x1; vertices[index++] = uvs.y1; - // color vertices[index++] = sprite.alpha; - // ---- // xy vertices[index++] = w0; @@ -331,21 +319,17 @@ vertices[index++] = sprite.scale.x; vertices[index++] = sprite.scale.y; - //skew - vertices[index++] = sprite.skew.x; - vertices[index++] = sprite.skew.y; - //rotation vertices[index++] = sprite.rotation; // uv vertices[index++] = uvs.x2; vertices[index++] = uvs.y2; - // color vertices[index++] = sprite.alpha; - // ---- + + // xy vertices[index++] = w1; @@ -358,17 +342,12 @@ vertices[index++] = sprite.scale.x; vertices[index++] = sprite.scale.y; - //skew - vertices[index++] = sprite.skew.x; - vertices[index++] = sprite.skew.y; - //rotation vertices[index++] = sprite.rotation; // uv vertices[index++] = uvs.x3; vertices[index++] = uvs.y3; - // color vertices[index++] = sprite.alpha; @@ -459,8 +438,7 @@ gl.vertexAttribPointer(this.shader.attributes.aPositionCoord, 2, gl.FLOAT, false, stride, 5 * 4); gl.vertexAttribPointer(this.shader.attributes.aScale, 2, gl.FLOAT, false, stride, 7 * 4); - gl.vertexAttribPointer(this.shader.attributes.aSkew, 2, gl.FLOAT, false, stride, 9 * 4); - gl.vertexAttribPointer(this.shader.attributes.aRotation, 1, gl.FLOAT, false, stride, 11 * 4); + gl.vertexAttribPointer(this.shader.attributes.aRotation, 1, gl.FLOAT, false, stride, 9 * 4); }; /** diff --git a/src/core/sprites/webgl/SpriteBatchShader.js b/src/core/sprites/webgl/SpriteBatchShader.js index f689d1c..1f53252 100644 --- a/src/core/sprites/webgl/SpriteBatchShader.js +++ b/src/core/sprites/webgl/SpriteBatchShader.js @@ -18,7 +18,6 @@ 'attribute vec2 aPositionCoord;', 'attribute vec2 aScale;', - 'attribute vec2 aSkew;', 'attribute float aRotation;', 'uniform mat3 projectionMatrix;', @@ -34,8 +33,8 @@ 'void main(void){', ' vec2 v;', ' vec2 sv = aVertexPosition * aScale;', - ' v.x = (sv.x) * cos(aRotation + aSkew.y) - (sv.y) * sin(aRotation + aSkew.x);', - ' v.y = (sv.x) * sin(aRotation + aSkew.y) + (sv.y) * cos(aRotation + aSkew.x);', + ' v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);', + ' v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);', ' v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;', @@ -69,7 +68,6 @@ { aPositionCoord: 0, aScale: 0, - aSkew: 0, aRotation: 0 } );