Fixes for Pixi update WebGL UV calls.

This commit is contained in:
photonstorm 2014-10-11 04:18:42 +01:00
parent 163a6c46f3
commit ac27f12c95
11 changed files with 45 additions and 7 deletions

View file

@ -80,6 +80,8 @@ Version 2.1.3 - "Ravinda" - in development
### Updates
* Changed the Animation constructor parameter `delay` to `frameRate` as it's a more accurate term of what it should be. Internally nothing changed.
* Circle.getBounds added.
* Ellipse.getBounds added.
### Bug Fixes

View file

@ -69,7 +69,7 @@
<script src="$path/src/pixi/renderers/canvas/utils/CanvasTinter.js"></script>
<script src="$path/src/pixi/renderers/canvas/CanvasRenderer.js"></script>
<script src="$path/src/pixi/renderers/canvas/CanvasGraphics.js"></script>
<script src="$path/src/pixi/primitives/Graphics.js"></script>
<script src="$path/src/pixi/extras/Strip.js"></script>
<script src="$path/src/pixi/extras/Rope.js"></script>
<script src="$path/src/pixi/extras/TilingSprite.js"></script>
@ -87,6 +87,8 @@
<script src="$path/src/geom/Ellipse.js"></script>
<script src="$path/src/geom/Polygon.js"></script>
<script src="$path/src/pixi/primitives/Graphics.js"></script>
<script src="$path/src/core/Camera.js"></script>
<script src="$path/src/core/State.js"></script>
<script src="$path/src/core/StateManager.js"></script>

View file

@ -83,3 +83,8 @@ PIXI.InteractionManager = PIXI.InteractionManager || function () {};
// Equally we're going to supress the Pixi console log, with their agreement.
PIXI.dontSayHello = true;
// PIXI.Polygon.prototype.type = PIXI.Graphics.POLY;
// PIXI.Rectangle.prototype.type = PIXI.Graphics.RECT;
// PIXI.Circle.prototype.type = PIXI.Graphics.CIRC;
// PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP;

View file

@ -615,7 +615,7 @@ Phaser.Game.prototype = {
this.renderType = Phaser.CANVAS;
}
this.renderer = new PIXI.CanvasRenderer(this.width, this.height, this.canvas, this.transparent);
this.renderer = new PIXI.CanvasRenderer(this.width, this.height, { "view": this.canvas, "transparent": this.transparent, "resolution": 1, "clearBeforeRender": true });
this.context = this.renderer.context;
}
else
@ -627,7 +627,8 @@ Phaser.Game.prototype = {
{
// They requested WebGL and their browser supports it
this.renderType = Phaser.WEBGL;
this.renderer = new PIXI.WebGLRenderer(this.width, this.height, this.canvas, this.transparent, this.antialias, this.preserveDrawingBuffer);
this.renderer = new PIXI.WebGLRenderer(this.width, this.height, { "view": this.canvas, "transparent": this.transparent, "resolution": 1, "antialias": this.antialias, "preserveDrawingBuffer": this.preserveDrawingBuffer });
this.context = null;
}

View file

@ -1305,7 +1305,8 @@ Phaser.BitmapData.prototype = {
{
// Only needed if running in WebGL, otherwise this array will never get cleared down
// should use the rendersession
PIXI.updateWebGLTexture(this.baseTexture, this.game.renderer.gl);
// PIXI.updateWebGLTexture(this.baseTexture, this.game.renderer.gl);
// this.baseTexture._updateUvs();
this.dirty = false;
}

View file

@ -360,7 +360,8 @@ Phaser.Image.prototype.setFrame = function(frame) {
{
if (this.game.renderType === Phaser.WEBGL)
{
PIXI.WebGLRenderer.updateTextureFrame(this.texture);
this.texture._updateUvs();
// PIXI.WebGLRenderer.updateTextureFrame(this.texture);
}
}

View file

@ -476,7 +476,8 @@ Phaser.Sprite.prototype.setFrame = function(frame) {
{
if (this.game.renderType === Phaser.WEBGL)
{
PIXI.WebGLRenderer.updateTextureFrame(this.texture);
this.texture._updateUvs();
// PIXI.WebGLRenderer.updateTextureFrame(this.texture);
}
}

View file

@ -426,7 +426,8 @@ Phaser.TileSprite.prototype.setFrame = function(frame) {
if (this.game.renderType === Phaser.WEBGL)
{
PIXI.WebGLRenderer.updateTextureFrame(this.texture);
this.texture._updateUvs();
// PIXI.WebGLRenderer.updateTextureFrame(this.texture);
}
};

View file

@ -53,6 +53,8 @@ Phaser.Circle = function (x, y, diameter) {
Phaser.Circle.prototype = {
type: null,
/**
* The circumference of the circle.
* @method Phaser.Circle#circumference
@ -62,6 +64,15 @@ Phaser.Circle.prototype = {
return 2 * (Math.PI * this._radius);
},
/**
* Returns the framing rectangle of the circle as a Phaser.Rectangle object
* @method Phaser.Circle#getBounds
* @return {Phaser.Rectangle} The bounds of the Circle.
*/
getBounds: function () {
return new Phaser.Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);
},
/**
* Sets the members of Circle to the specified values.
* @method Phaser.Circle#setTo

View file

@ -68,6 +68,17 @@ Phaser.Ellipse.prototype = {
},
/**
* Returns the framing rectangle of the ellipse as a Phaser.Rectangle object.
* @method Phaser.Ellipse#getBounds
* @return {Phaser.Rectangle} The bounds of the Circle.
*/
getBounds: function () {
return new Phaser.Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);
},
/**
* Copies the x, y, width and height properties from any given object to this Ellipse.
* @method Phaser.Ellipse#copyFrom

View file

@ -27,6 +27,8 @@ Phaser.Polygon = function (points) {
Phaser.Polygon.prototype = {
type: null,
/**
* Creates a copy of the given Polygon.
* This is a deep clone, the resulting copy contains new Phaser.Point objects