Merge branch 'dev'
This commit is contained in:
commit
f3bf5874ed
6 changed files with 191 additions and 41 deletions
111
bin/pixi.dev.js
111
bin/pixi.dev.js
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (c) 2012, Mat Groves
|
* Copyright (c) 2012, Mat Groves
|
||||||
* http://goodboydigital.com/
|
* http://goodboydigital.com/
|
||||||
*
|
*
|
||||||
* Compiled: 2014-01-05
|
* Compiled: 2014-01-06
|
||||||
*
|
*
|
||||||
* pixi.js is licensed under the MIT License.
|
* pixi.js is licensed under the MIT License.
|
||||||
* http://www.opensource.org/licenses/mit-license.php
|
* http://www.opensource.org/licenses/mit-license.php
|
||||||
|
@ -1342,7 +1342,7 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
|
||||||
if ( index !== -1 )
|
if ( index !== -1 )
|
||||||
{
|
{
|
||||||
// update the stage reference..
|
// update the stage reference..
|
||||||
if(this.stage)this.removeStageReference();
|
if(this.stage)child.removeStageReference();
|
||||||
|
|
||||||
child.parent = undefined;
|
child.parent = undefined;
|
||||||
this.children.splice( index, 1 );
|
this.children.splice( index, 1 );
|
||||||
|
@ -1424,24 +1424,27 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function()
|
||||||
PIXI.DisplayObjectContainer.prototype.setStageReference = function(stage)
|
PIXI.DisplayObjectContainer.prototype.setStageReference = function(stage)
|
||||||
{
|
{
|
||||||
this.stage = stage;
|
this.stage = stage;
|
||||||
|
if(this.interactive)this.stage.dirty = true;
|
||||||
|
|
||||||
for(var i=0,j=this.children.length; i<j; i++)
|
for(var i=0,j=this.children.length; i<j; i++)
|
||||||
{
|
{
|
||||||
var child = this.children[i];
|
var child = this.children[i];
|
||||||
if(child.interactive)this.stage.dirty = true;
|
|
||||||
child.setStageReference(stage);
|
child.setStageReference(stage);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PIXI.DisplayObjectContainer.prototype.removeStageReference = function()
|
PIXI.DisplayObjectContainer.prototype.removeStageReference = function()
|
||||||
{
|
{
|
||||||
|
|
||||||
for(var i=0,j=this.children.length; i<j; i++)
|
for(var i=0,j=this.children.length; i<j; i++)
|
||||||
{
|
{
|
||||||
var child = this.children[i];
|
var child = this.children[i];
|
||||||
if(child.interactive)this.stage.dirty = true;
|
|
||||||
child.removeStageReference();
|
child.removeStageReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.interactive)this.stage.dirty = true;
|
||||||
|
|
||||||
this.stage = null;
|
this.stage = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5324,7 +5327,6 @@ PIXI.updateWebGLTexture = function(texture, gl)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a lost webgl context
|
* Handles a lost webgl context
|
||||||
*
|
*
|
||||||
|
@ -5715,7 +5717,7 @@ PIXI.WebGLSpriteBatch.prototype.render = function(sprite)
|
||||||
|
|
||||||
PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
|
PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
|
||||||
{
|
{
|
||||||
var texture = tilingSprite.texture;
|
var texture = tilingSprite.tilingTexture;
|
||||||
|
|
||||||
if(texture.baseTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size)
|
if(texture.baseTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size)
|
||||||
{
|
{
|
||||||
|
@ -5739,8 +5741,8 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
|
||||||
var offsetX = tilingSprite.tilePosition.x/texture.baseTexture.width;
|
var offsetX = tilingSprite.tilePosition.x/texture.baseTexture.width;
|
||||||
var offsetY = tilingSprite.tilePosition.y/texture.baseTexture.height;
|
var offsetY = tilingSprite.tilePosition.y/texture.baseTexture.height;
|
||||||
|
|
||||||
var scaleX = (tilingSprite.width / texture.baseTexture.width) / tilingSprite.tileScale.x;
|
var scaleX = (tilingSprite.width / texture.baseTexture.width) / (tilingSprite.tileScale.x * tilingSprite.tileScaleOffset.x);
|
||||||
var scaleY = (tilingSprite.height / texture.baseTexture.height) / tilingSprite.tileScale.y;
|
var scaleY = (tilingSprite.height / texture.baseTexture.height) / (tilingSprite.tileScale.y * tilingSprite.tileScaleOffset.y);
|
||||||
|
|
||||||
uvs[0] = 0 - offsetX;
|
uvs[0] = 0 - offsetX;
|
||||||
uvs[1] = 0 - offsetY;
|
uvs[1] = 0 - offsetY;
|
||||||
|
@ -7819,8 +7821,6 @@ PIXI.TilingSprite = function(texture, width, height)
|
||||||
this.width = width || 100;
|
this.width = width || 100;
|
||||||
this.height = height || 100;
|
this.height = height || 100;
|
||||||
|
|
||||||
texture.baseTexture._powerOf2 = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The scaling of the image that is being tiled
|
* The scaling of the image that is being tiled
|
||||||
*
|
*
|
||||||
|
@ -7829,6 +7829,9 @@ PIXI.TilingSprite = function(texture, width, height)
|
||||||
*/
|
*/
|
||||||
this.tileScale = new PIXI.Point(1,1);
|
this.tileScale = new PIXI.Point(1,1);
|
||||||
|
|
||||||
|
|
||||||
|
this.tileScaleOffset = new PIXI.Point(1,1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The offset position of the image that is being tiled
|
* The offset position of the image that is being tiled
|
||||||
*
|
*
|
||||||
|
@ -7882,9 +7885,9 @@ Object.defineProperty(PIXI.TilingSprite.prototype, 'height', {
|
||||||
PIXI.TilingSprite.prototype.onTextureUpdate = function()
|
PIXI.TilingSprite.prototype.onTextureUpdate = function()
|
||||||
{
|
{
|
||||||
// so if _width is 0 then width was not set..
|
// so if _width is 0 then width was not set..
|
||||||
//if(this._width)this.scale.x = this._width / this.texture.frame.width;
|
//console.log("HI MUM")
|
||||||
//if(this._height)this.scale.y = this._height / this.texture.frame.height;
|
|
||||||
// alert(this._width)
|
|
||||||
this.updateFrame = true;
|
this.updateFrame = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7910,8 +7913,8 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
|
||||||
renderSession.filterManager.pushFilter(this._filterBlock);
|
renderSession.filterManager.pushFilter(this._filterBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!this.tilingTexture)this.generateTilingTexture(true);
|
||||||
renderSession.spriteBatch.renderTilingSprite(this);
|
else renderSession.spriteBatch.renderTilingSprite(this);
|
||||||
|
|
||||||
// simple render children!
|
// simple render children!
|
||||||
for(i=0,j=this.children.length; i<j; i++)
|
for(i=0,j=this.children.length; i<j; i++)
|
||||||
|
@ -7928,7 +7931,8 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderSession.spriteBatch.renderTilingSprite(this);
|
if(!this.tilingTexture)this.generateTilingTexture(true);
|
||||||
|
else renderSession.spriteBatch.renderTilingSprite(this);
|
||||||
|
|
||||||
// simple render children!
|
// simple render children!
|
||||||
for(i=0,j=this.children.length; i<j; i++)
|
for(i=0,j=this.children.length; i<j; i++)
|
||||||
|
@ -7938,6 +7942,7 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
||||||
{
|
{
|
||||||
if(this.visible === false || this.alpha === 0)return;
|
if(this.visible === false || this.alpha === 0)return;
|
||||||
|
@ -7955,7 +7960,15 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
||||||
|
|
||||||
|
|
||||||
if(!this.__tilePattern)
|
if(!this.__tilePattern)
|
||||||
this.__tilePattern = context.createPattern(this.texture.baseTexture.source, 'repeat');
|
{
|
||||||
|
this.generateTilingTexture(false);
|
||||||
|
|
||||||
|
if(this.tilingTexture)
|
||||||
|
{
|
||||||
|
this.__tilePattern = context.createPattern(this.tilingTexture.baseTexture.source, 'repeat');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// check blend mode
|
// check blend mode
|
||||||
if(this.blendMode !== renderSession.currentBlendMode)
|
if(this.blendMode !== renderSession.currentBlendMode)
|
||||||
|
@ -7968,7 +7981,7 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
||||||
|
|
||||||
var tilePosition = this.tilePosition;
|
var tilePosition = this.tilePosition;
|
||||||
var tileScale = this.tileScale;
|
var tileScale = this.tileScale;
|
||||||
|
// console.log(tileScale.x)
|
||||||
// offset
|
// offset
|
||||||
context.scale(tileScale.x,tileScale.y);
|
context.scale(tileScale.x,tileScale.y);
|
||||||
context.translate(tilePosition.x, tilePosition.y);
|
context.translate(tilePosition.x, tilePosition.y);
|
||||||
|
@ -8054,6 +8067,68 @@ PIXI.TilingSprite.prototype.getBounds = function()
|
||||||
|
|
||||||
return bounds;
|
return bounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
PIXI.TilingSprite.prototype.generateTilingTexture = function(forcePowerOfTwo)
|
||||||
|
{
|
||||||
|
var texture = this.texture;
|
||||||
|
|
||||||
|
if(!texture.baseTexture.hasLoaded)return;
|
||||||
|
|
||||||
|
var baseTexture = texture.baseTexture;
|
||||||
|
var frame = texture.frame;
|
||||||
|
|
||||||
|
var targetWidth, targetHeight;
|
||||||
|
|
||||||
|
// check that the frame is the same size as the base texture.
|
||||||
|
|
||||||
|
var isFrame = frame.width !== baseTexture.width || frame.height !== baseTexture.height;
|
||||||
|
|
||||||
|
this.tilingTexture = texture;
|
||||||
|
|
||||||
|
var newTextureRequired = false;
|
||||||
|
|
||||||
|
if(!forcePowerOfTwo)
|
||||||
|
{
|
||||||
|
if(isFrame)
|
||||||
|
{
|
||||||
|
targetWidth = frame.width;
|
||||||
|
targetHeight = frame.height;
|
||||||
|
|
||||||
|
newTextureRequired = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
targetWidth = PIXI.getNextPowerOfTwo(texture.frame.width);
|
||||||
|
targetHeight = PIXI.getNextPowerOfTwo(texture.frame.height);
|
||||||
|
|
||||||
|
if(frame.width !== targetWidth && frame.height !== targetHeight)newTextureRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(newTextureRequired)
|
||||||
|
{
|
||||||
|
var canvasBuffer = new PIXI.CanvasBuffer(targetWidth, targetHeight);
|
||||||
|
|
||||||
|
canvasBuffer.context.drawImage(texture.baseTexture.source,
|
||||||
|
frame.x,
|
||||||
|
frame.y,
|
||||||
|
frame.width,
|
||||||
|
frame.height,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
targetWidth,
|
||||||
|
targetHeight);
|
||||||
|
|
||||||
|
this.tilingTexture = PIXI.Texture.fromCanvas(canvasBuffer.canvas);
|
||||||
|
|
||||||
|
this.tileScaleOffset.x = frame.width / targetWidth;
|
||||||
|
this.tileScaleOffset.y = frame.height / targetHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.tilingTexture.baseTexture._powerOf2 = true;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @author Mat Groves http://matgroves.com/ @Doormat23
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
||||||
* based on pixi impact spine implementation made by Eemeli Kelokorpi (@ekelokorpi) https://github.com/ekelokorpi
|
* based on pixi impact spine implementation made by Eemeli Kelokorpi (@ekelokorpi) https://github.com/ekelokorpi
|
||||||
|
|
12
bin/pixi.js
12
bin/pixi.js
File diff suppressed because one or more lines are too long
|
@ -176,7 +176,7 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
|
||||||
if ( index !== -1 )
|
if ( index !== -1 )
|
||||||
{
|
{
|
||||||
// update the stage reference..
|
// update the stage reference..
|
||||||
if(this.stage)this.removeStageReference();
|
if(this.stage)child.removeStageReference();
|
||||||
|
|
||||||
child.parent = undefined;
|
child.parent = undefined;
|
||||||
this.children.splice( index, 1 );
|
this.children.splice( index, 1 );
|
||||||
|
@ -258,24 +258,27 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function()
|
||||||
PIXI.DisplayObjectContainer.prototype.setStageReference = function(stage)
|
PIXI.DisplayObjectContainer.prototype.setStageReference = function(stage)
|
||||||
{
|
{
|
||||||
this.stage = stage;
|
this.stage = stage;
|
||||||
|
if(this.interactive)this.stage.dirty = true;
|
||||||
|
|
||||||
for(var i=0,j=this.children.length; i<j; i++)
|
for(var i=0,j=this.children.length; i<j; i++)
|
||||||
{
|
{
|
||||||
var child = this.children[i];
|
var child = this.children[i];
|
||||||
if(child.interactive)this.stage.dirty = true;
|
|
||||||
child.setStageReference(stage);
|
child.setStageReference(stage);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PIXI.DisplayObjectContainer.prototype.removeStageReference = function()
|
PIXI.DisplayObjectContainer.prototype.removeStageReference = function()
|
||||||
{
|
{
|
||||||
|
|
||||||
for(var i=0,j=this.children.length; i<j; i++)
|
for(var i=0,j=this.children.length; i<j; i++)
|
||||||
{
|
{
|
||||||
var child = this.children[i];
|
var child = this.children[i];
|
||||||
if(child.interactive)this.stage.dirty = true;
|
|
||||||
child.removeStageReference();
|
child.removeStageReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.interactive)this.stage.dirty = true;
|
||||||
|
|
||||||
this.stage = null;
|
this.stage = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@ PIXI.TilingSprite = function(texture, width, height)
|
||||||
this.width = width || 100;
|
this.width = width || 100;
|
||||||
this.height = height || 100;
|
this.height = height || 100;
|
||||||
|
|
||||||
texture.baseTexture._powerOf2 = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The scaling of the image that is being tiled
|
* The scaling of the image that is being tiled
|
||||||
*
|
*
|
||||||
|
@ -29,6 +27,9 @@ PIXI.TilingSprite = function(texture, width, height)
|
||||||
*/
|
*/
|
||||||
this.tileScale = new PIXI.Point(1,1);
|
this.tileScale = new PIXI.Point(1,1);
|
||||||
|
|
||||||
|
|
||||||
|
this.tileScaleOffset = new PIXI.Point(1,1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The offset position of the image that is being tiled
|
* The offset position of the image that is being tiled
|
||||||
*
|
*
|
||||||
|
@ -82,9 +83,9 @@ Object.defineProperty(PIXI.TilingSprite.prototype, 'height', {
|
||||||
PIXI.TilingSprite.prototype.onTextureUpdate = function()
|
PIXI.TilingSprite.prototype.onTextureUpdate = function()
|
||||||
{
|
{
|
||||||
// so if _width is 0 then width was not set..
|
// so if _width is 0 then width was not set..
|
||||||
//if(this._width)this.scale.x = this._width / this.texture.frame.width;
|
//console.log("HI MUM")
|
||||||
//if(this._height)this.scale.y = this._height / this.texture.frame.height;
|
|
||||||
// alert(this._width)
|
|
||||||
this.updateFrame = true;
|
this.updateFrame = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -110,8 +111,8 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
|
||||||
renderSession.filterManager.pushFilter(this._filterBlock);
|
renderSession.filterManager.pushFilter(this._filterBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!this.tilingTexture)this.generateTilingTexture(true);
|
||||||
renderSession.spriteBatch.renderTilingSprite(this);
|
else renderSession.spriteBatch.renderTilingSprite(this);
|
||||||
|
|
||||||
// simple render children!
|
// simple render children!
|
||||||
for(i=0,j=this.children.length; i<j; i++)
|
for(i=0,j=this.children.length; i<j; i++)
|
||||||
|
@ -128,7 +129,8 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderSession.spriteBatch.renderTilingSprite(this);
|
if(!this.tilingTexture)this.generateTilingTexture(true);
|
||||||
|
else renderSession.spriteBatch.renderTilingSprite(this);
|
||||||
|
|
||||||
// simple render children!
|
// simple render children!
|
||||||
for(i=0,j=this.children.length; i<j; i++)
|
for(i=0,j=this.children.length; i<j; i++)
|
||||||
|
@ -138,6 +140,7 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
||||||
{
|
{
|
||||||
if(this.visible === false || this.alpha === 0)return;
|
if(this.visible === false || this.alpha === 0)return;
|
||||||
|
@ -155,7 +158,15 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
||||||
|
|
||||||
|
|
||||||
if(!this.__tilePattern)
|
if(!this.__tilePattern)
|
||||||
this.__tilePattern = context.createPattern(this.texture.baseTexture.source, 'repeat');
|
{
|
||||||
|
this.generateTilingTexture(false);
|
||||||
|
|
||||||
|
if(this.tilingTexture)
|
||||||
|
{
|
||||||
|
this.__tilePattern = context.createPattern(this.tilingTexture.baseTexture.source, 'repeat');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// check blend mode
|
// check blend mode
|
||||||
if(this.blendMode !== renderSession.currentBlendMode)
|
if(this.blendMode !== renderSession.currentBlendMode)
|
||||||
|
@ -168,7 +179,7 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
||||||
|
|
||||||
var tilePosition = this.tilePosition;
|
var tilePosition = this.tilePosition;
|
||||||
var tileScale = this.tileScale;
|
var tileScale = this.tileScale;
|
||||||
|
// console.log(tileScale.x)
|
||||||
// offset
|
// offset
|
||||||
context.scale(tileScale.x,tileScale.y);
|
context.scale(tileScale.x,tileScale.y);
|
||||||
context.translate(tilePosition.x, tilePosition.y);
|
context.translate(tilePosition.x, tilePosition.y);
|
||||||
|
@ -253,4 +264,66 @@ PIXI.TilingSprite.prototype.getBounds = function()
|
||||||
this._currentBounds = bounds;
|
this._currentBounds = bounds;
|
||||||
|
|
||||||
return bounds;
|
return bounds;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
PIXI.TilingSprite.prototype.generateTilingTexture = function(forcePowerOfTwo)
|
||||||
|
{
|
||||||
|
var texture = this.texture;
|
||||||
|
|
||||||
|
if(!texture.baseTexture.hasLoaded)return;
|
||||||
|
|
||||||
|
var baseTexture = texture.baseTexture;
|
||||||
|
var frame = texture.frame;
|
||||||
|
|
||||||
|
var targetWidth, targetHeight;
|
||||||
|
|
||||||
|
// check that the frame is the same size as the base texture.
|
||||||
|
|
||||||
|
var isFrame = frame.width !== baseTexture.width || frame.height !== baseTexture.height;
|
||||||
|
|
||||||
|
this.tilingTexture = texture;
|
||||||
|
|
||||||
|
var newTextureRequired = false;
|
||||||
|
|
||||||
|
if(!forcePowerOfTwo)
|
||||||
|
{
|
||||||
|
if(isFrame)
|
||||||
|
{
|
||||||
|
targetWidth = frame.width;
|
||||||
|
targetHeight = frame.height;
|
||||||
|
|
||||||
|
newTextureRequired = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
targetWidth = PIXI.getNextPowerOfTwo(texture.frame.width);
|
||||||
|
targetHeight = PIXI.getNextPowerOfTwo(texture.frame.height);
|
||||||
|
|
||||||
|
if(frame.width !== targetWidth && frame.height !== targetHeight)newTextureRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(newTextureRequired)
|
||||||
|
{
|
||||||
|
var canvasBuffer = new PIXI.CanvasBuffer(targetWidth, targetHeight);
|
||||||
|
|
||||||
|
canvasBuffer.context.drawImage(texture.baseTexture.source,
|
||||||
|
frame.x,
|
||||||
|
frame.y,
|
||||||
|
frame.width,
|
||||||
|
frame.height,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
targetWidth,
|
||||||
|
targetHeight);
|
||||||
|
|
||||||
|
this.tilingTexture = PIXI.Texture.fromCanvas(canvasBuffer.canvas);
|
||||||
|
|
||||||
|
this.tileScaleOffset.x = frame.width / targetWidth;
|
||||||
|
this.tileScaleOffset.y = frame.height / targetHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.tilingTexture.baseTexture._powerOf2 = true;
|
||||||
};
|
};
|
|
@ -404,7 +404,6 @@ PIXI.updateWebGLTexture = function(texture, gl)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a lost webgl context
|
* Handles a lost webgl context
|
||||||
*
|
*
|
||||||
|
|
|
@ -195,7 +195,7 @@ PIXI.WebGLSpriteBatch.prototype.render = function(sprite)
|
||||||
|
|
||||||
PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
|
PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
|
||||||
{
|
{
|
||||||
var texture = tilingSprite.texture;
|
var texture = tilingSprite.tilingTexture;
|
||||||
|
|
||||||
if(texture.baseTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size)
|
if(texture.baseTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size)
|
||||||
{
|
{
|
||||||
|
@ -219,8 +219,8 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
|
||||||
var offsetX = tilingSprite.tilePosition.x/texture.baseTexture.width;
|
var offsetX = tilingSprite.tilePosition.x/texture.baseTexture.width;
|
||||||
var offsetY = tilingSprite.tilePosition.y/texture.baseTexture.height;
|
var offsetY = tilingSprite.tilePosition.y/texture.baseTexture.height;
|
||||||
|
|
||||||
var scaleX = (tilingSprite.width / texture.baseTexture.width) / tilingSprite.tileScale.x;
|
var scaleX = (tilingSprite.width / texture.baseTexture.width) / (tilingSprite.tileScale.x * tilingSprite.tileScaleOffset.x);
|
||||||
var scaleY = (tilingSprite.height / texture.baseTexture.height) / tilingSprite.tileScale.y;
|
var scaleY = (tilingSprite.height / texture.baseTexture.height) / (tilingSprite.tileScale.y * tilingSprite.tileScaleOffset.y);
|
||||||
|
|
||||||
uvs[0] = 0 - offsetX;
|
uvs[0] = 0 - offsetX;
|
||||||
uvs[1] = 0 - offsetY;
|
uvs[1] = 0 - offsetY;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue