mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
Parent matrix and now optional and it won't draw a line cap unless the first point has been set
This commit is contained in:
parent
19a50eaa98
commit
5e126b80fa
1 changed files with 25 additions and 18 deletions
|
@ -229,7 +229,7 @@ var TextureTintPipeline = new Class({
|
||||||
* @private
|
* @private
|
||||||
* @since 3.12.0
|
* @since 3.12.0
|
||||||
*/
|
*/
|
||||||
this.firstQuad = [ 0, 0, 0, 0 ];
|
this.firstQuad = [ 0, 0, 0, 0, 0 ];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal path quad cache.
|
* Internal path quad cache.
|
||||||
|
@ -239,7 +239,7 @@ var TextureTintPipeline = new Class({
|
||||||
* @private
|
* @private
|
||||||
* @since 3.12.0
|
* @since 3.12.0
|
||||||
*/
|
*/
|
||||||
this.prevQuad = [ 0, 0, 0, 0 ];
|
this.prevQuad = [ 0, 0, 0, 0, 0 ];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used internally for triangulating a polygon.
|
* Used internally for triangulating a polygon.
|
||||||
|
@ -949,8 +949,11 @@ var TextureTintPipeline = new Class({
|
||||||
|
|
||||||
var calcMatrix = this._tempMatrix3;
|
var calcMatrix = this._tempMatrix3;
|
||||||
|
|
||||||
// Multiply and store result in calcMatrix
|
// Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix
|
||||||
parentMatrix.multiply(currentMatrix, calcMatrix);
|
if (parentMatrix)
|
||||||
|
{
|
||||||
|
parentMatrix.multiply(currentMatrix, calcMatrix);
|
||||||
|
}
|
||||||
|
|
||||||
var xw = x + width;
|
var xw = x + width;
|
||||||
var yh = y + height;
|
var yh = y + height;
|
||||||
|
@ -1161,6 +1164,10 @@ var TextureTintPipeline = new Class({
|
||||||
{
|
{
|
||||||
this.renderer.setPipeline(this);
|
this.renderer.setPipeline(this);
|
||||||
|
|
||||||
|
// Reset the closePath booleans
|
||||||
|
this.prevQuad[4] = 0;
|
||||||
|
this.firstQuad[4] = 0;
|
||||||
|
|
||||||
var pathLength = path.length - 1;
|
var pathLength = path.length - 1;
|
||||||
|
|
||||||
for (var pathIndex = 0; pathIndex < pathLength; pathIndex++)
|
for (var pathIndex = 0; pathIndex < pathLength; pathIndex++)
|
||||||
|
@ -1204,14 +1211,12 @@ var TextureTintPipeline = new Class({
|
||||||
|
|
||||||
var calcMatrix = this._tempMatrix3;
|
var calcMatrix = this._tempMatrix3;
|
||||||
|
|
||||||
// Multiply and store result in calcMatrix
|
// Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix
|
||||||
parentMatrix.multiply(currentMatrix, calcMatrix);
|
if (parentMatrix)
|
||||||
|
|
||||||
if (this.vertexCount + 6 > this.vertexCapacity)
|
|
||||||
{
|
{
|
||||||
this.flush();
|
parentMatrix.multiply(currentMatrix, calcMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
var dx = bx - ax;
|
var dx = bx - ax;
|
||||||
var dy = by - ay;
|
var dy = by - ay;
|
||||||
|
|
||||||
|
@ -1264,7 +1269,7 @@ var TextureTintPipeline = new Class({
|
||||||
// TL, BL, BR, TR
|
// TL, BL, BR, TR
|
||||||
this.batchQuad(tlX, tlY, blX, blY, brX, brY, trX, trY, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect);
|
this.batchQuad(tlX, tlY, blX, blY, brX, brY, trX, trY, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect);
|
||||||
|
|
||||||
if (lineWidth <= 1)
|
if (lineWidth <= 2)
|
||||||
{
|
{
|
||||||
// No point doing a linejoin if the line isn't thick enough
|
// No point doing a linejoin if the line isn't thick enough
|
||||||
return;
|
return;
|
||||||
|
@ -1273,22 +1278,23 @@ var TextureTintPipeline = new Class({
|
||||||
var prev = this.prevQuad;
|
var prev = this.prevQuad;
|
||||||
var first = this.firstQuad;
|
var first = this.firstQuad;
|
||||||
|
|
||||||
if (index > 0)
|
if (index > 0 && prev[4])
|
||||||
{
|
{
|
||||||
this.batchQuad(tlX, tlY, blX, blY, prev[0], prev[1], prev[2], prev[3], u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect);
|
this.batchQuad(tlX, tlY, blX, blY, prev[0], prev[1], prev[2], prev[3], u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
first[0] = blX;
|
first[0] = tlX;
|
||||||
first[1] = blY;
|
first[1] = tlY;
|
||||||
first[2] = tlX;
|
first[2] = blX;
|
||||||
first[3] = tlY;
|
first[3] = blY;
|
||||||
|
first[4] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (closePath)
|
if (closePath && first[4])
|
||||||
{
|
{
|
||||||
// Add a join for the final path segment
|
// Add a join for the final path segment
|
||||||
this.batchQuad(first[0], first[1], first[2], first[3], brX, brY, trX, trY, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect);
|
this.batchQuad(brX, brY, trX, trY, first[0], first[1], first[2], first[3], u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1298,6 +1304,7 @@ var TextureTintPipeline = new Class({
|
||||||
prev[1] = brY;
|
prev[1] = brY;
|
||||||
prev[2] = trX;
|
prev[2] = trX;
|
||||||
prev[3] = trY;
|
prev[3] = trY;
|
||||||
|
prev[4] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue