Graphics Bug fixs
Fixed bug where webGL graphics not working in safari Fixed bug where Collinear points cause lines to be draw oddly
This commit is contained in:
parent
acc4092e21
commit
f8094acb2b
8 changed files with 232 additions and 56 deletions
|
@ -1,14 +1,3 @@
|
|||
/**
|
||||
* @license
|
||||
* Pixi.JS - v1.3.0
|
||||
* Copyright (c) 2012, Mat Groves
|
||||
* http://goodboydigital.com/
|
||||
*
|
||||
* Compiled: 2013-11-03
|
||||
*
|
||||
* Pixi.JS is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
/**
|
||||
* @author Mat Groves http://matgroves.com/ @Doormat23
|
||||
*/
|
||||
|
@ -3722,7 +3711,13 @@ PIXI.activatePrimitiveShader = function()
|
|||
var gl = PIXI.gl;
|
||||
|
||||
gl.useProgram(PIXI.primitiveShader.program);
|
||||
|
||||
gl.disableVertexAttribArray(PIXI.defaultShader.aVertexPosition);
|
||||
gl.disableVertexAttribArray(PIXI.defaultShader.colorAttribute);
|
||||
gl.disableVertexAttribArray(PIXI.defaultShader.aTextureCoord);
|
||||
|
||||
gl.enableVertexAttribArray(PIXI.primitiveShader.aVertexPosition);
|
||||
gl.enableVertexAttribArray(PIXI.primitiveShader.colorAttribute);
|
||||
}
|
||||
|
||||
PIXI.deactivatePrimitiveShader = function()
|
||||
|
@ -3730,7 +3725,14 @@ PIXI.deactivatePrimitiveShader = function()
|
|||
var gl = PIXI.gl;
|
||||
|
||||
gl.useProgram(PIXI.defaultShader.program);
|
||||
|
||||
gl.disableVertexAttribArray(PIXI.primitiveShader.aVertexPosition);
|
||||
gl.disableVertexAttribArray(PIXI.primitiveShader.colorAttribute);
|
||||
|
||||
gl.enableVertexAttribArray(PIXI.defaultShader.aVertexPosition);
|
||||
gl.enableVertexAttribArray(PIXI.defaultShader.colorAttribute);
|
||||
gl.enableVertexAttribArray(PIXI.defaultShader.aTextureCoord);
|
||||
|
||||
}
|
||||
|
||||
PIXI.activateStripShader = function()
|
||||
|
@ -3833,11 +3835,11 @@ PIXI.PixiShader.prototype.init = function()
|
|||
this.uSampler = gl.getUniformLocation(program, "uSampler");
|
||||
this.projectionVector = gl.getUniformLocation(program, "projectionVector");
|
||||
this.offsetVector = gl.getUniformLocation(program, "offsetVector");
|
||||
//this.dimensions = gl.getUniformLocation(this.program, "dimensions");
|
||||
|
||||
// get and store the attributes
|
||||
this.aVertexPosition = gl.getAttribLocation(program, "aVertexPosition");
|
||||
this.colorAttribute = gl.getAttribLocation(program, "aColor");
|
||||
//this.dimensions = gl.getUniformLocation(this.program, "dimensions");
|
||||
|
||||
// get and store the attributes
|
||||
this.aVertexPosition = gl.getAttribLocation(program, "aVertexPosition");
|
||||
this.aTextureCoord = gl.getAttribLocation(program, "aTextureCoord");
|
||||
|
||||
// add those custom shaders!
|
||||
|
@ -4032,13 +4034,13 @@ PIXI.PrimitiveShader.prototype.init = function()
|
|||
// get and store the uniforms for the shader
|
||||
this.projectionVector = gl.getUniformLocation(program, "projectionVector");
|
||||
this.offsetVector = gl.getUniformLocation(program, "offsetVector");
|
||||
|
||||
// get and store the attributes
|
||||
this.aVertexPosition = gl.getAttribLocation(program, "aVertexPosition");
|
||||
this.colorAttribute = gl.getAttribLocation(program, "aColor");
|
||||
|
||||
// get and store the attributes
|
||||
this.aVertexPosition = gl.getAttribLocation(program, "aVertexPosition");
|
||||
|
||||
this.translationMatrix = gl.getUniformLocation(program, "translationMatrix");
|
||||
this.alpha = gl.getUniformLocation(program, "alpha");
|
||||
this.translationMatrix = gl.getUniformLocation(program, "translationMatrix");
|
||||
this.alpha = gl.getUniformLocation(program, "alpha");
|
||||
|
||||
this.program = program;
|
||||
}
|
||||
|
@ -4107,20 +4109,15 @@ PIXI.WebGLGraphics.renderGraphics = function(graphics, projection)
|
|||
gl.uniform2f(PIXI.primitiveShader.offsetVector, -PIXI.offset.x, -PIXI.offset.y);
|
||||
|
||||
gl.uniform1f(PIXI.primitiveShader.alpha, graphics.worldAlpha);
|
||||
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, graphics._webGL.buffer);
|
||||
|
||||
// WHY DOES THIS LINE NEED TO BE THERE???
|
||||
//gl.vertexAttribPointer(PIXI.shaderProgram.vertexPositionAttribute, 2, gl.FLOAT, false, 0, 0);
|
||||
// its not even used.. but need to be set or it breaks?
|
||||
// only on pc though..
|
||||
|
||||
gl.vertexAttribPointer(PIXI.primitiveShader.aVertexPosition, 2, gl.FLOAT, false, 4 * 6, 0);
|
||||
gl.vertexAttribPointer(PIXI.primitiveShader.colorAttribute, 4, gl.FLOAT, false,4 * 6, 2 * 4);
|
||||
|
||||
// set the index buffer!
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, graphics._webGL.indexBuffer);
|
||||
|
||||
|
||||
gl.drawElements(gl.TRIANGLE_STRIP, graphics._webGL.indices.length, gl.UNSIGNED_SHORT, 0 );
|
||||
|
||||
PIXI.deactivatePrimitiveShader();
|
||||
|
@ -4441,16 +4438,27 @@ PIXI.WebGLGraphics.buildLine = function(graphicsData, webGLData)
|
|||
c2 = (-perp2x + p3x) * (-perp2y + p2y) - (-perp2x + p2x) * (-perp2y + p3y);
|
||||
|
||||
denom = a1*b2 - a2*b1;
|
||||
|
||||
if (denom == 0) {
|
||||
denom+=1;
|
||||
}
|
||||
|
||||
if(Math.abs(denom) < 0.1 )
|
||||
{
|
||||
|
||||
denom+=10.1;
|
||||
verts.push(p2x - perpx , p2y - perpy,
|
||||
r, g, b, alpha);
|
||||
|
||||
verts.push(p2x + perpx , p2y + perpy,
|
||||
r, g, b, alpha);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
px = (b1*c2 - b2*c1)/denom;
|
||||
py = (a2*c1 - a1*c2)/denom;
|
||||
|
||||
|
||||
pdist = (px -p2x) * (px -p2x) + (py -p2y) + (py -p2y);
|
||||
|
||||
|
||||
if(pdist > 140 * 140)
|
||||
{
|
||||
perp3x = perpx - perp2x;
|
||||
|
@ -4475,6 +4483,7 @@ PIXI.WebGLGraphics.buildLine = function(graphicsData, webGLData)
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
verts.push(px , py);
|
||||
verts.push(r, g, b, alpha);
|
||||
|
||||
|
@ -12159,4 +12168,5 @@ Object.defineProperty(PIXI.DotScreenFilter.prototype, 'angle', {
|
|||
} else {
|
||||
root.PIXI = PIXI;
|
||||
}
|
||||
}).call(this);
|
||||
}).call(this);
|
||||
//@ sourceMappingURL=pixi.dev.js.map
|
Loading…
Add table
Add a link
Reference in a new issue