diff --git a/bin/pixi.dev.js b/bin/pixi.dev.js index c1cf45b..fba9b25 100644 --- a/bin/pixi.dev.js +++ b/bin/pixi.dev.js @@ -1,22 +1,22 @@ -/** - * @license - * pixi.js - v2.2.7 - * Copyright (c) 2012-2014, Mat Groves - * http://goodboydigital.com/ - * - * Compiled: 2015-02-25 - * - * pixi.js is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license.php - */ -/** - * @author Mat Groves http://matgroves.com/ @Doormat23 - */ - -(function(){ - - var root = this; - +/** + * @license + * pixi.js - v2.2.7 + * Copyright (c) 2012-2014, Mat Groves + * http://goodboydigital.com/ + * + * Compiled: 2015-02-25 + * + * pixi.js is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license.php + */ +/** + * @author Mat Groves http://matgroves.com/ @Doormat23 + */ + +(function(){ + + var root = this; + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -230,7 +230,7 @@ PIXI.dontSayHello = true; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -274,7 +274,7 @@ /** * Sets the point to a new x and y position. * If y is omitted, both x and y will be set to x. - * + * * @method set * @param [x=0] {Number} position of the point on the x axis * @param [y=0] {Number} position of the point on the y axis @@ -286,7 +286,7 @@ }; // constructor -PIXI.Point.prototype.constructor = PIXI.Point; +PIXI.Point.prototype.constructor = PIXI.Point; /** * @author Mat Groves http://matgroves.com/ */ @@ -380,7 +380,7 @@ // constructor PIXI.Rectangle.prototype.constructor = PIXI.Rectangle; -PIXI.EmptyRectangle = new PIXI.Rectangle(0,0,0,0); +PIXI.EmptyRectangle = new PIXI.Rectangle(0,0,0,0); /** * @author Adrien Brault */ @@ -417,7 +417,7 @@ * An array of the points of this polygon * @property points * @type Array(Point)|Array(Number) - * + * */ this.points = points; @@ -471,7 +471,7 @@ // constructor PIXI.Polygon.prototype.constructor = PIXI.Polygon; - + /** * @author Chad Engler */ @@ -563,7 +563,7 @@ // constructor PIXI.Circle.prototype.constructor = PIXI.Circle; - + /** * @author Chad Engler */ @@ -664,7 +664,7 @@ // constructor PIXI.Ellipse.prototype.constructor = PIXI.Ellipse; - + /** * @author Mat Groves http://matgroves.com/ */ @@ -678,7 +678,7 @@ * @param y {Number} The Y coordinate of the upper-left corner of the rounded rectangle * @param width {Number} The overall width of this rounded rectangle * @param height {Number} The overall height of this rounded rectangle - * @param radius {Number} Controls the radius of the rounded corners + * @param radius {Number} Controls the radius of the rounded corners */ PIXI.RoundedRectangle = function(x, y, width, height, radius) { @@ -766,14 +766,14 @@ // constructor PIXI.RoundedRectangle.prototype.constructor = PIXI.RoundedRectangle; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ /** - * The Matrix class is now an object, which makes it a lot faster, - * here is a representation of it : + * The Matrix class is now an object, which makes it a lot faster, + * here is a representation of it : * | a | b | tx| * | c | d | ty| * | 0 | 0 | 1 | @@ -922,7 +922,7 @@ newPos = newPos || new PIXI.Point(); var id = 1 / (this.a * this.d + this.c * -this.b); - + newPos.x = this.d * id * pos.x + -this.c * id * pos.y + (this.ty * this.c - this.tx * this.d) * id; newPos.y = this.a * id * pos.y + -this.b * id * pos.x + (-this.ty * this.a + this.tx * this.b) * id; @@ -931,7 +931,7 @@ /** * Translates the matrix on the x and y. - * + * * @method translate * @param {Number} x * @param {Number} y @@ -941,13 +941,13 @@ { this.tx += x; this.ty += y; - + return this; }; /** * Applies a scale transformation to the matrix. - * + * * @method scale * @param {Number} x The amount to scale horizontally * @param {Number} y The amount to scale vertically @@ -987,13 +987,13 @@ this.d = c1 * sin+this.d * cos; this.tx = tx1 * cos - this.ty * sin; this.ty = tx1 * sin + this.ty * cos; - + return this; }; /** * Appends the given Matrix to this Matrix. - * + * * @method append * @param {Matrix} matrix * @return {Matrix} This matrix. Good for chaining method calls. @@ -1012,13 +1012,13 @@ this.tx = matrix.tx * a1 + matrix.ty * c1 + this.tx; this.ty = matrix.tx * b1 + matrix.ty * d1 + this.ty; - + return this; }; /** * Resets this Matix to an identity (default) matrix. - * + * * @method identity * @return {Matrix} This matrix. Good for chaining method calls. */ @@ -1035,7 +1035,7 @@ }; PIXI.identityMatrix = new PIXI.Matrix(); - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -1254,7 +1254,7 @@ /* * MOUSE Callbacks */ - + /** * A callback that is used when the users mouse rolls over the displayObject * @method mouseover @@ -1515,7 +1515,7 @@ d = this._cr * this.scale.y; tx = this.position.x; ty = this.position.y; - + // check for pivot.. not often used so geared towards that fact! if(this.pivot.x || this.pivot.y) { @@ -1531,7 +1531,7 @@ wt.tx = tx * pt.a + ty * pt.c + pt.tx; wt.ty = tx * pt.b + ty * pt.d + pt.ty; - + } else { @@ -1608,10 +1608,10 @@ var bounds = this.getLocalBounds(); var renderTexture = new PIXI.RenderTexture(bounds.width | 0, bounds.height | 0, renderer, scaleMode, resolution); - + PIXI.DisplayObject._tempMatrix.tx = -bounds.x; PIXI.DisplayObject._tempMatrix.ty = -bounds.y; - + renderTexture.render(this, PIXI.DisplayObject._tempMatrix); return renderTexture; @@ -1651,7 +1651,7 @@ */ PIXI.DisplayObject.prototype.toLocal = function(position, from) { - // + // if (from) { position = from.toGlobal(position); @@ -1714,7 +1714,7 @@ PIXI.DisplayObject._tempMatrix.tx = -bounds.x; PIXI.DisplayObject._tempMatrix.ty = -bounds.y; - + this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix, true); this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); @@ -1801,7 +1801,7 @@ this.position.y = value; } }); - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -1828,7 +1828,7 @@ this.children = []; // fast access to update transform.. - + }; // constructor @@ -1847,7 +1847,7 @@ return this.scale.x * this.getLocalBounds().width; }, set: function(value) { - + var width = this.getLocalBounds().width; if(width !== 0) @@ -1859,7 +1859,7 @@ this.scale.x = 1; } - + this._width = value; } }); @@ -2008,7 +2008,7 @@ throw new Error('getChildAt: Supplied index '+ index +' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); } return this.children[index]; - + }; /** @@ -2022,7 +2022,7 @@ { var index = this.children.indexOf( child ); if(index === -1)return; - + return this.removeChildAt( index ); }; @@ -2130,13 +2130,13 @@ for(var i=0,j=this.children.length; i 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0); }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 * @author Chad Engler https://github.com/englercj @Rolnaaba @@ -5612,7 +5612,7 @@ PIXI.Event.prototype.stopImmediatePropagation = function stopImmediatePropagation() { this.stoppedImmediate = true; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -5627,14 +5627,14 @@ * @static * @param width=800 {Number} the width of the renderers view * @param height=600 {Number} the height of the renderers view - * + * * @param [options] {Object} The optional renderer parameters * @param [options.view] {HTMLCanvasElement} the canvas to use as a view, optional * @param [options.transparent=false] {Boolean} If the render view is transparent, default false * @param [options.antialias=false] {Boolean} sets antialias (only applicable in chrome at the moment) * @param [options.preserveDrawingBuffer=false] {Boolean} enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context * @param [options.resolution=1] {Number} the resolution of the renderer retina would be 2 - * + * */ PIXI.autoDetectRenderer = function(width, height, options) { @@ -5661,22 +5661,22 @@ /** * This helper function will automatically detect which renderer you should be using. * This function is very similar to the autoDetectRenderer function except that is will return a canvas renderer for android. - * Even thought both android chrome supports webGL the canvas implementation perform better at the time of writing. + * Even thought both android chrome supports webGL the canvas implementation perform better at the time of writing. * This function will likely change and update as webGL performance improves on these devices. - * + * * @method autoDetectRecommendedRenderer * @for PIXI * @static * @param width=800 {Number} the width of the renderers view * @param height=600 {Number} the height of the renderers view - * + * * @param [options] {Object} The optional renderer parameters * @param [options.view] {HTMLCanvasElement} the canvas to use as a view, optional * @param [options.transparent=false] {Boolean} If the render view is transparent, default false * @param [options.antialias=false] {Boolean} sets antialias (only applicable in chrome at the moment) * @param [options.preserveDrawingBuffer=false] {Boolean} enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context * @param [options.resolution=1] {Number} the resolution of the renderer retina would be 2 - * + * */ PIXI.autoDetectRecommendedRenderer = function(width, height, options) { @@ -5701,7 +5701,7 @@ return new PIXI.CanvasRenderer(width, height, options); }; - + /* PolyK library url: http://polyk.ivank.net @@ -5870,7 +5870,7 @@ { return ((ay-by)*(cx-bx) + (bx-ax)*(cy-by) >= 0) === sign; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -5959,7 +5959,7 @@ return shaderProgram; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 * @author Richard Davey http://www.photonstorm.com @photonstorm @@ -6348,7 +6348,7 @@ ' vTextureCoord = aTextureCoord;', ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', '}' -]; +]; /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6366,7 +6366,7 @@ * @private */ this._UID = PIXI._UID++; - + /** * @property gl * @type WebGLContext @@ -6436,7 +6436,7 @@ * @type Number */ this.textureCount = 0; - + this.init(); }; @@ -6444,7 +6444,7 @@ /** * Initialises the shader. -* +* * @method init */ PIXI.PixiFastShader.prototype.init = function() @@ -6452,7 +6452,7 @@ var gl = this.gl; var program = PIXI.compileProgram(gl, this.vertexSrc, this.fragmentSrc); - + gl.useProgram(program); // get and store the uniforms for the shader @@ -6472,7 +6472,7 @@ this.aTextureCoord = gl.getAttribLocation(program, 'aTextureCoord'); this.colorAttribute = gl.getAttribLocation(program, 'aColor'); - + // Begin worst hack eva // // WHY??? ONLY on my chrome pixel the line above returns -1 when using filters? @@ -6485,7 +6485,7 @@ } this.attributes = [this.aVertexPosition, this.aPositionCoord, this.aScale, this.aRotation, this.aTextureCoord, this.colorAttribute]; - + // End worst hack eva // this.program = program; @@ -6493,7 +6493,7 @@ /** * Destroys the shader. -* +* * @method destroy */ PIXI.PixiFastShader.prototype.destroy = function() @@ -6504,7 +6504,7 @@ this.attributes = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6522,7 +6522,7 @@ * @private */ this._UID = PIXI._UID++; - + /** * @property gl * @type WebGLContext @@ -6586,7 +6586,7 @@ /** * Initialises the shader. -* +* * @method init */ PIXI.StripShader.prototype.init = function() @@ -6617,7 +6617,7 @@ /** * Destroys the shader. -* +* * @method destroy */ PIXI.StripShader.prototype.destroy = function() @@ -6628,7 +6628,7 @@ this.attribute = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6646,7 +6646,7 @@ * @private */ this._UID = PIXI._UID++; - + /** * @property gl * @type WebGLContext @@ -6705,7 +6705,7 @@ /** * Initialises the shader. -* +* * @method init */ PIXI.PrimitiveShader.prototype.init = function() @@ -6735,7 +6735,7 @@ /** * Destroys the shader. -* +* * @method destroy */ PIXI.PrimitiveShader.prototype.destroy = function() @@ -6746,7 +6746,7 @@ this.attributes = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6805,7 +6805,7 @@ 'uniform mat3 translationMatrix;', 'uniform vec2 projectionVector;', 'uniform vec2 offsetVector;', - + 'uniform vec3 tint;', 'uniform float alpha;', 'uniform vec3 color;', @@ -6827,7 +6827,7 @@ /** * Initialises the shader. -* +* * @method init */ PIXI.ComplexPrimitiveShader.prototype.init = function() @@ -6858,7 +6858,7 @@ /** * Destroys the shader. -* +* * @method destroy */ PIXI.ComplexPrimitiveShader.prototype.destroy = function() @@ -6869,7 +6869,7 @@ this.attribute = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6921,27 +6921,27 @@ // render quad.. gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, ( webGLData.indices.length - 4 ) * 2 ); - + renderSession.stencilManager.popStencil(graphics, webGLData, renderSession); } else { webGLData = webGL.data[i]; - + renderSession.shaderManager.setShader( shader );//activatePrimitiveShader(); shader = renderSession.shaderManager.primitiveShader; gl.uniformMatrix3fv(shader.translationMatrix, false, graphics.worldTransform.toArray(true)); - + gl.uniform1f(shader.flipY, 1); - + gl.uniform2f(shader.projectionVector, projection.x, -projection.y); gl.uniform2f(shader.offsetVector, -offset.x, -offset.y); gl.uniform3fv(shader.tintColor, PIXI.hex2rgb(graphics.tint)); gl.uniform1f(shader.alpha, graphics.worldAlpha); - + gl.bindBuffer(gl.ARRAY_BUFFER, webGLData.buffer); @@ -6989,13 +6989,13 @@ PIXI.WebGLGraphics.graphicsDataPool.push( graphicsData ); } - // clear the array and reset the index.. + // clear the array and reset the index.. webGL.data = []; webGL.lastIndex = 0; } - + var webGLData; - + // loop through the graphics datas and construct each one.. // if the object is a complex fill then the new stencil buffer technique will be used // other wise graphics objects will be pushed into a batch.. @@ -7024,7 +7024,7 @@ if(data.points.length < 6 * 2) { webGLData = PIXI.WebGLGraphics.switchMode(webGL, 0); - + var canDrawUsingSimple = PIXI.WebGLGraphics.buildPoly(data, webGLData); // console.log(canDrawUsingSimple); @@ -7034,7 +7034,7 @@ webGLData = PIXI.WebGLGraphics.switchMode(webGL, 1); PIXI.WebGLGraphics.buildComplexPoly(data, webGLData); } - + } else { @@ -7054,7 +7054,7 @@ else { webGLData = PIXI.WebGLGraphics.switchMode(webGL, 0); - + if(data.type === PIXI.Graphics.RECT) { PIXI.WebGLGraphics.buildRectangle(data, webGLData); @@ -7223,8 +7223,8 @@ var triangles = PIXI.PolyK.Triangulate(recPoints); - // - + // + var i = 0; for (i = 0; i < triangles.length; i+=3) { @@ -7322,7 +7322,7 @@ var y = circleData.y; var width; var height; - + // TODO - bit hacky?? if(graphicsData.type === PIXI.Graphics.CIRC) { @@ -7651,8 +7651,8 @@ maxX, maxY, minX, maxY); - // push a quad onto the end.. - + // push a quad onto the end.. + //TODO - this aint needed! var length = points.length / 2; for (i = 0; i < length; i++) @@ -7766,7 +7766,7 @@ this.dirty = false; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8193,7 +8193,7 @@ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.source); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, texture.scaleMode === PIXI.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST); - + if(texture.mipmap && PIXI.isPowerOfTwo(texture.width, texture.height)) { @@ -8321,7 +8321,7 @@ }; PIXI.WebGLRenderer.glContextId = 0; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8355,8 +8355,8 @@ /** * Sets-up the given blendMode from WebGL's point of view. -* -* @method setBlendMode +* +* @method setBlendMode * @param blendMode {Number} the blendMode, should be a Pixi const, such as PIXI.BlendModes.ADD */ PIXI.WebGLBlendModeManager.prototype.setBlendMode = function(blendMode) @@ -8364,23 +8364,23 @@ if(this.currentBlendMode === blendMode)return false; this.currentBlendMode = blendMode; - + var blendModeWebGL = PIXI.blendModesWebGL[this.currentBlendMode]; this.gl.blendFunc(blendModeWebGL[0], blendModeWebGL[1]); - + return true; }; /** * Destroys this object. -* +* * @method destroy */ PIXI.WebGLBlendModeManager.prototype.destroy = function() { this.gl = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8398,8 +8398,8 @@ /** * Sets the drawing context to the one given in parameter. -* -* @method setContext +* +* @method setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLMaskManager.prototype.setContext = function(gl) @@ -8409,7 +8409,7 @@ /** * Applies the Mask and adds it to the current filter stack. -* +* * @method pushMask * @param maskData {Array} * @param renderSession {Object} @@ -8430,7 +8430,7 @@ /** * Removes the last filter from the filter stack and doesn't return it. -* +* * @method popMask * @param maskData {Array} * @param renderSession {Object} an object containing all the useful parameters @@ -8443,14 +8443,14 @@ /** * Destroys the mask stack. -* +* * @method destroy */ PIXI.WebGLMaskManager.prototype.destroy = function() { this.gl = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8469,8 +8469,8 @@ /** * Sets the drawing context to the one given in parameter. -* -* @method setContext +* +* @method setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLStencilManager.prototype.setContext = function(gl) @@ -8480,7 +8480,7 @@ /** * Applies the Mask and adds it to the current filter stack. -* +* * @method pushMask * @param graphics {Graphics} * @param webGLData {Array} @@ -8513,7 +8513,7 @@ if(webGLData.mode === 1) { gl.drawElements(gl.TRIANGLE_FAN, webGLData.indices.length - 4, gl.UNSIGNED_SHORT, 0 ); - + if(this.reverse) { gl.stencilFunc(gl.EQUAL, 0xFF - level, 0xFF); @@ -8527,7 +8527,7 @@ // draw a quad to increment.. gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, ( webGLData.indices.length - 4 ) * 2 ); - + if(this.reverse) { gl.stencilFunc(gl.EQUAL,0xFF-(level+1), 0xFF); @@ -8572,7 +8572,7 @@ /** * TODO this does not belong here! - * + * * @method bindGraphics * @param graphics {Graphics} * @param webGLData {Array} @@ -8597,7 +8597,7 @@ renderSession.shaderManager.setShader( shader ); gl.uniform1f(shader.flipY, renderSession.flipY); - + gl.uniformMatrix3fv(shader.translationMatrix, false, graphics.worldTransform.toArray(true)); gl.uniform2f(shader.projectionVector, projection.x, -projection.y); @@ -8632,7 +8632,7 @@ gl.uniform3fv(shader.tintColor, PIXI.hex2rgb(graphics.tint)); gl.uniform1f(shader.alpha, graphics.worldAlpha); - + gl.bindBuffer(gl.ARRAY_BUFFER, webGLData.buffer); gl.vertexAttribPointer(shader.aVertexPosition, 2, gl.FLOAT, false, 4 * 6, 0); @@ -8653,7 +8653,7 @@ { var gl = this.gl; this.stencilStack.pop(); - + this.count--; if(this.stencilStack.length === 0) @@ -8670,7 +8670,7 @@ this.bindGraphics(graphics, webGLData, renderSession); gl.colorMask(false, false, false, false); - + if(webGLData.mode === 1) { this.reverse = !this.reverse; @@ -8688,13 +8688,13 @@ // draw a quad to increment.. gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, ( webGLData.indices.length - 4 ) * 2 ); - + gl.stencilFunc(gl.ALWAYS,0,0xFF); gl.stencilOp(gl.KEEP,gl.KEEP,gl.INVERT); // draw the triangle strip! gl.drawElements(gl.TRIANGLE_FAN, webGLData.indices.length - 4, gl.UNSIGNED_SHORT, 0 ); - + if(!this.reverse) { gl.stencilFunc(gl.EQUAL,0xFF-(level), 0xFF); @@ -8740,7 +8740,7 @@ /** * Destroys the mask stack. -* +* * @method destroy */ PIXI.WebGLStencilManager.prototype.destroy = function() @@ -8748,7 +8748,7 @@ this.stencilStack = null; this.gl = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8795,14 +8795,14 @@ /** * Initialises the context and the properties. -* -* @method setContext +* +* @method setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLShaderManager.prototype.setContext = function(gl) { this.gl = gl; - + // the next one is used for rendering primitives this.primitiveShader = new PIXI.PrimitiveShader(gl); @@ -8822,9 +8822,9 @@ /** * Takes the attributes given in parameters. -* +* * @method setAttribs -* @param attribs {Array} attribs +* @param attribs {Array} attribs */ PIXI.WebGLShaderManager.prototype.setAttribs = function(attribs) { @@ -8865,14 +8865,14 @@ /** * Sets the current shader. -* +* * @method setShader * @param shader {Any} */ PIXI.WebGLShaderManager.prototype.setShader = function(shader) { if(this._currentId === shader._UID)return false; - + this._currentId = shader._UID; this.currentShader = shader; @@ -8885,7 +8885,7 @@ /** * Destroys this object. -* +* * @method destroy */ PIXI.WebGLShaderManager.prototype.destroy = function() @@ -8906,14 +8906,14 @@ this.gl = null; }; - + /** * @author Mat Groves - * + * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ * for creating the original pixi version! * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now share 4 bytes on the vertex buffer - * + * * Heavily inspired by LibGDX's WebGLSpriteBatch: * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/WebGLSpriteBatch.java */ @@ -8975,7 +8975,7 @@ * @type Uint16Array */ this.indices = new PIXI.Uint16Array(numIndices); - + /** * @property lastIndexCount * @type Number @@ -9115,7 +9115,7 @@ { var texture = sprite.texture; - //TODO set blend modes.. + //TODO set blend modes.. // check texture.. if(this.currentBatchSize >= this.size) { @@ -9133,7 +9133,7 @@ var aY = sprite.anchor.y; var w0, w1, h0, h1; - + if (texture.trim) { // if the sprite is trimmed then we need to add the extra space before transforming the sprite coords.. @@ -9156,7 +9156,7 @@ } var index = this.currentBatchSize * 4 * this.vertSize; - + var resolution = texture.baseTexture.resolution; var worldTransform = sprite.worldTransform; @@ -9207,7 +9207,7 @@ positions[index+15] = a * w1 + c * h0 + tx; positions[index+16] = d * h0 + b * w1 + ty; } - + // uv positions[index+2] = uvs.x0; positions[index+3] = uvs.y0; @@ -9236,7 +9236,7 @@ /** * Renders a TilingSprite using the spriteBatch. -* +* * @method renderTilingSprite * @param sprite {TilingSprite} the tilingSprite to render */ @@ -9329,7 +9329,7 @@ positions[index++] = uvs.y1; // color colors[index++] = color; - + // xy positions[index++] = a * w0 + c * h0 + tx; positions[index++] = d * h0 + b * w0 + ty; @@ -9386,7 +9386,7 @@ gl.vertexAttribPointer(shader.colorAttribute, 4, gl.UNSIGNED_BYTE, true, stride, 4 * 4); } - // upload the verts to the buffer + // upload the verts to the buffer if(this.currentBatchSize > ( this.size * 0.5 ) ) { gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices); @@ -9410,7 +9410,7 @@ var sprite; for (var i = 0, j = this.currentBatchSize; i < j; i++) { - + sprite = this.sprites[i]; nextTexture = sprite.texture.baseTexture; @@ -9437,7 +9437,7 @@ if( shaderSwap ) { currentShader = nextShader; - + shader = currentShader.shaders[gl.id]; if(!shader) @@ -9455,7 +9455,7 @@ this.renderSession.shaderManager.setShader(shader); if(shader.dirty)shader.syncUniforms(); - + // both thease only need to be set if they are changing.. // set the projection var projection = this.renderSession.projection; @@ -9503,7 +9503,7 @@ // now draw those suckas! gl.drawElements(gl.TRIANGLES, size * 6, gl.UNSIGNED_SHORT, startIndex * 6 * 2); - + // increment the draw count this.renderSession.drawCount++; }; @@ -9527,24 +9527,24 @@ /** * Destroys the SpriteBatch. -* +* * @method destroy */ PIXI.WebGLSpriteBatch.prototype.destroy = function() { this.vertices = null; this.indices = null; - + this.gl.deleteBuffer( this.vertexBuffer ); this.gl.deleteBuffer( this.indexBuffer ); - + this.currentBaseTexture = null; - + this.gl = null; -}; +}; /** * @author Mat Groves - * + * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ * for creating the original pixi version! * @@ -9595,7 +9595,7 @@ * @type Uint16Array */ this.indices = new PIXI.Uint16Array(numIndices); - + /** * @property vertexBuffer * @type Object @@ -9641,7 +9641,7 @@ * @type BaseTexture */ this.currentBaseTexture = null; - + /** * @property currentBlendMode * @type Number @@ -9653,7 +9653,7 @@ * @type Object */ this.renderSession = null; - + /** * @property shader * @type Object @@ -9728,19 +9728,19 @@ var sprite = children[0]; // if the uvs have not updated then no point rendering just yet! - + // check texture. if(!sprite.texture._uvs)return; - + this.currentBaseTexture = sprite.texture.baseTexture; - + // check blend mode if(sprite.blendMode !== this.renderSession.blendModeManager.currentBlendMode) { this.flush(); this.renderSession.blendModeManager.setBlendMode(sprite.blendMode); } - + for(var i=0,j= children.length; i ( this.size * 0.5 ) ) { gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices); @@ -9918,10 +9918,10 @@ gl.bufferSubData(gl.ARRAY_BUFFER, 0, view); } - + // now draw those suckas! gl.drawElements(gl.TRIANGLES, this.currentBatchSize * 6, gl.UNSIGNED_SHORT, 0); - + // then reset the batch! this.currentBatchSize = 0; @@ -9968,9 +9968,9 @@ gl.vertexAttribPointer(this.shader.aRotation, 1, gl.FLOAT, false, stride, 6 * 4); gl.vertexAttribPointer(this.shader.aTextureCoord, 2, gl.FLOAT, false, stride, 7 * 4); gl.vertexAttribPointer(this.shader.colorAttribute, 1, gl.FLOAT, false, stride, 9 * 4); - + }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -9986,7 +9986,7 @@ * @type Array */ this.filterStack = []; - + /** * @property offsetX * @type Number @@ -10004,8 +10004,8 @@ /** * Initialises the context and the properties. -* -* @method setContext +* +* @method setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLFilterManager.prototype.setContext = function(gl) @@ -10018,8 +10018,8 @@ /** * @method begin -* @param renderSession {RenderSession} -* @param buffer {ArrayBuffer} +* @param renderSession {RenderSession} +* @param buffer {ArrayBuffer} */ PIXI.WebGLFilterManager.prototype.begin = function(renderSession, buffer) { @@ -10034,7 +10034,7 @@ /** * Applies the filter and adds it to the current filter stack. -* +* * @method pushFilter * @param filterBlock {Object} the filter that will be pushed to the current filter stack */ @@ -10110,7 +10110,7 @@ /** * Removes the last filter from the filter stack and doesn't return it. -* +* * @method popFilter */ PIXI.WebGLFilterManager.prototype.popFilter = function() @@ -10264,7 +10264,7 @@ // bind the buffer gl.bindFramebuffer(gl.FRAMEBUFFER, buffer ); - // set the blend mode! + // set the blend mode! //gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA) // set texture @@ -10287,7 +10287,7 @@ /** * Applies the filter to the specified area. -* +* * @method applyFilterPass * @param filter {AbstractFilter} the filter that needs to be applied * @param filterArea {Texture} TODO - might need an update @@ -10348,7 +10348,7 @@ /** * Initialises the shader buffers. -* +* * @method initShaderBuffers */ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function() @@ -10396,7 +10396,7 @@ /** * Destroys the filter and removes it from the filter stack. -* +* * @method destroy */ PIXI.WebGLFilterManager.prototype.destroy = function() @@ -10404,7 +10404,7 @@ var gl = this.gl; this.filterStack = null; - + this.offsetX = 0; this.offsetY = 0; @@ -10412,7 +10412,7 @@ for (var i = 0; i < this.texturePool.length; i++) { this.texturePool[i].destroy(); } - + this.texturePool = null; //destroy buffers.. @@ -10421,7 +10421,7 @@ gl.deleteBuffer(this.colorBuffer); gl.deleteBuffer(this.indexBuffer); }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -10476,7 +10476,7 @@ this.renderBuffer = gl.createRenderbuffer(); gl.bindRenderbuffer(gl.RENDERBUFFER, this.renderBuffer); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.renderBuffer); - + this.resize(width, height); }; @@ -10484,13 +10484,13 @@ /** * Clears the filter texture. -* +* * @method clear */ PIXI.FilterTexture.prototype.clear = function() { var gl = this.gl; - + gl.clearColor(0,0,0, 0); gl.clear(gl.COLOR_BUFFER_BIT); }; @@ -10520,7 +10520,7 @@ /** * Destroys the filter texture. -* +* * @method destroy */ PIXI.FilterTexture.prototype.destroy = function() @@ -10532,7 +10532,7 @@ this.frameBuffer = null; this.texture = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -10609,7 +10609,7 @@ this.width = this.canvas.width = width; this.height = this.canvas.height = height; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -10638,7 +10638,7 @@ var context = renderSession.context; context.save(); - + var cacheAlpha = maskData.alpha; var transform = maskData.worldTransform; @@ -10668,7 +10668,7 @@ { renderSession.context.restore(); }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -10685,8 +10685,8 @@ /** * Basically this method just needs a sprite and a color and tints the sprite with the given color. - * - * @method getTintedTexture + * + * @method getTintedTexture * @static * @param sprite {Sprite} the sprite to tint * @param color {Number} the color to use to tint the sprite with @@ -10699,14 +10699,14 @@ color = PIXI.CanvasTinter.roundColor(color); var stringColor = "#" + ("00000" + ( color | 0).toString(16)).substr(-6); - + texture.tintCache = texture.tintCache || {}; if(texture.tintCache[stringColor]) return texture.tintCache[stringColor]; // clone texture.. var canvas = PIXI.CanvasTinter.canvas || document.createElement("canvas"); - + //PIXI.CanvasTinter.tintWithPerPixel(texture, stringColor, canvas); PIXI.CanvasTinter.tintMethod(texture, color, canvas); @@ -10730,7 +10730,7 @@ /** * Tint a texture using the "multiply" operation. - * + * * @method tintWithMultiply * @static * @param texture {Texture} the texture to tint @@ -10747,9 +10747,9 @@ canvas.height = crop.height; context.fillStyle = "#" + ("00000" + ( color | 0).toString(16)).substr(-6); - + context.fillRect(0, 0, crop.width, crop.height); - + context.globalCompositeOperation = "multiply"; context.drawImage(texture.baseTexture.source, @@ -10777,7 +10777,7 @@ /** * Tint a texture using the "overlay" operation. - * + * * @method tintWithOverlay * @static * @param texture {Texture} the texture to tint @@ -10792,7 +10792,7 @@ canvas.width = crop.width; canvas.height = crop.height; - + context.globalCompositeOperation = "copy"; context.fillStyle = "#" + ("00000" + ( color | 0).toString(16)).substr(-6); context.fillRect(0, 0, crop.width, crop.height); @@ -10807,13 +10807,13 @@ 0, crop.width, crop.height); - + //context.globalCompositeOperation = "copy"; }; /** * Tint a texture pixel per pixel. - * + * * @method tintPerPixel * @static * @param texture {Texture} the texture to tint @@ -10828,7 +10828,7 @@ canvas.width = crop.width; canvas.height = crop.height; - + context.globalCompositeOperation = "copy"; context.drawImage(texture.baseTexture.source, crop.x, @@ -10859,7 +10859,7 @@ /** * Rounds the specified color according to the PIXI.CanvasTinter.cacheStepsPerColorChannel. - * + * * @method roundColor * @static * @param color {number} the color to round, should be a hex color @@ -10880,7 +10880,7 @@ /** * Number of steps which will be used as a cap when rounding colors. * - * @property cacheStepsPerColorChannel + * @property cacheStepsPerColorChannel * @type Number * @static */ @@ -10906,12 +10906,12 @@ /** * The tinting method that will be used. - * + * * @method tintMethod * @static */ PIXI.CanvasTinter.tintMethod = PIXI.CanvasTinter.canUseMultiply ? PIXI.CanvasTinter.tintWithMultiply : PIXI.CanvasTinter.tintWithPerPixel; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -11077,7 +11077,7 @@ }; this.mapBlendModes(); - + this.resize(width, height); if("imageSmoothingEnabled" in this.context) @@ -11116,7 +11116,7 @@ this.context.fillStyle = "black"; this.context.clear(); } - + if (this.clearBeforeRender) { if (this.transparent) @@ -11129,7 +11129,7 @@ this.context.fillRect(0, 0, this.width , this.height); } } - + this.renderDisplayObject(stage); // run interaction! @@ -11257,7 +11257,7 @@ } } }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -11290,7 +11290,7 @@ this.updateGraphicsTint(graphics); graphics.dirty = false; } - + for (var i = 0; i < graphics.graphicsData.length; i++) { @@ -11486,9 +11486,9 @@ if(data.type === PIXI.Graphics.POLY) { context.beginPath(); - + var points = shape.points; - + context.moveTo(points[0], points[1]); for (var j=1; j < points.length/2; j++) @@ -11546,7 +11546,7 @@ } else if (data.type === PIXI.Graphics.RREC) { - + var pts = shape.points; var rx = pts[0]; var ry = pts[1]; @@ -11590,7 +11590,7 @@ /* var colorR = (fillColor >> 16 & 0xFF) / 255; var colorG = (fillColor >> 8 & 0xFF) / 255; - var colorB = (fillColor & 0xFF) / 255; + var colorB = (fillColor & 0xFF) / 255; colorR *= tintR; colorG *= tintG; @@ -11600,15 +11600,15 @@ colorR = (lineColor >> 16 & 0xFF) / 255; colorG = (lineColor >> 8 & 0xFF) / 255; - colorB = (lineColor & 0xFF) / 255; + colorB = (lineColor & 0xFF) / 255; colorR *= tintR; colorG *= tintG; colorB *= tintB; - lineColor = ((colorR*255 << 16) + (colorG*255 << 8) + colorB*255); + lineColor = ((colorR*255 << 16) + (colorG*255 << 8) + colorB*255); */ - + // super inline cos im an optimization NAZI :) data._fillTint = (((fillColor >> 16 & 0xFF) / 255 * tintR*255 << 16) + ((fillColor >> 8 & 0xFF) / 255 * tintG*255 << 8) + (fillColor & 0xFF) / 255 * tintB*255); data._lineTint = (((lineColor >> 16 & 0xFF) / 255 * tintR*255 << 16) + ((lineColor >> 8 & 0xFF) / 255 * tintG*255 << 8) + (lineColor & 0xFF) / 255 * tintB*255); @@ -11616,14 +11616,14 @@ } }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and rectangles to the display, and color and fill them. - * + * * @class Graphics * @extends DisplayObjectContainer * @constructor @@ -11685,7 +11685,7 @@ * @default PIXI.blendModes.NORMAL; */ this.blendMode = PIXI.blendModes.NORMAL; - + /** * Current path * @@ -11694,7 +11694,7 @@ * @private */ this.currentPath = null; - + /** * Array containing some WebGL-related properties used by the WebGL renderer. * @@ -11724,7 +11724,7 @@ /** * Used to detect if the graphics object has changed. If this is set to true then the graphics object will be recalculated. - * + * * @property dirty * @type Boolean * @private @@ -11733,7 +11733,7 @@ /** * Used to detect if the webgl graphics object has changed. If this is set to true then the graphics object will be recalculated. - * + * * @property webGLDirty * @type Boolean * @private @@ -11742,7 +11742,7 @@ /** * Used to detect if the cached sprite object needs to be updated. - * + * * @property cachedSpriteDirty * @type Boolean * @private @@ -11815,7 +11815,7 @@ this.currentPath.lineWidth = this.lineWidth; this.currentPath.lineColor = this.lineColor; this.currentPath.lineAlpha = this.lineAlpha; - + } return this; @@ -11880,7 +11880,7 @@ n = 20, points = this.currentPath.shape.points; if(points.length === 0)this.moveTo(0, 0); - + var fromX = points[points.length-2]; var fromY = points[points.length-1]; @@ -11936,7 +11936,7 @@ var fromX = points[points.length-2]; var fromY = points[points.length-1]; - + var j = 0; for (var i=1; i<=n; i++) @@ -11949,11 +11949,11 @@ t2 = j * j; t3 = t2 * j; - + points.push( dt3 * fromX + 3 * dt2 * j * cpX + 3 * dt * t2 * cpX2 + t3 * toX, dt3 * fromY + 3 * dt2 * j * cpY + 3 * dt * t2 * cpY2 + t3 * toY); } - + this.dirty = true; return this; @@ -11961,7 +11961,7 @@ /* * The arcTo() method creates an arc/curve between two tangents on the canvas. - * + * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * * @method arcTo @@ -12066,7 +12066,7 @@ this.moveTo(startX, startY); points = this.currentPath.shape.points; } - + if (startAngle === endAngle)return this; if( !anticlockwise && endAngle <= startAngle ) @@ -12088,7 +12088,7 @@ var cTheta = Math.cos(theta); var sTheta = Math.sin(theta); - + var segMinus = segs - 1; var remainder = ( segMinus % 1 ) / segMinus; @@ -12097,7 +12097,7 @@ { var real = i + remainder * i; - + var angle = ((theta) + startAngle + (theta2 * real)); var c = Math.cos(angle); @@ -12156,7 +12156,7 @@ /** * Draws a rectangle. - * + * * @method drawRect * * @param x {Number} The X coord of the top-left of the rectangle @@ -12174,7 +12174,7 @@ /** * Draws a rounded rectangle. - * + * * @method drawRoundedRect * * @param x {Number} The X coord of the top-left of the rectangle @@ -12270,16 +12270,16 @@ resolution = resolution || 1; var bounds = this.getBounds(); - + var canvasBuffer = new PIXI.CanvasBuffer(bounds.width * resolution, bounds.height * resolution); - + var texture = PIXI.Texture.fromCanvas(canvasBuffer.canvas, scaleMode); texture.baseTexture.resolution = resolution; canvasBuffer.context.scale(resolution, resolution); canvasBuffer.context.translate(-bounds.x,-bounds.y); - + PIXI.CanvasGraphics.renderGraphics(this, canvasBuffer.context); return texture; @@ -12289,7 +12289,7 @@ * Renders the object using the WebGL renderer * * @method _renderWebGL -* @param renderSession {RenderSession} +* @param renderSession {RenderSession} * @private */ PIXI.Graphics.prototype._renderWebGL = function(renderSession) @@ -12304,7 +12304,7 @@ { this._generateCachedSprite(); - + // we will also need to update the texture on the gpu too! this.updateCachedSpriteTexture(); @@ -12324,7 +12324,7 @@ if(this._mask)renderSession.maskManager.pushMask(this._mask, renderSession); if(this._filters)renderSession.filterManager.pushFilter(this._filterBlock); - + // check blend mode if(this.blendMode !== renderSession.spriteBatch.currentBlendMode) { @@ -12332,16 +12332,16 @@ var blendModeWebGL = PIXI.blendModesWebGL[renderSession.spriteBatch.currentBlendMode]; renderSession.spriteBatch.gl.blendFunc(blendModeWebGL[0], blendModeWebGL[1]); } - + // check if the webgl graphic needs to be updated if(this.webGLDirty) { this.dirty = true; this.webGLDirty = false; } - + PIXI.WebGLGraphics.renderGraphics(this, renderSession); - + // only render if it has children! if(this.children.length) { @@ -12358,7 +12358,7 @@ if(this._filters)renderSession.filterManager.popFilter(); if(this._mask)renderSession.maskManager.popMask(this.mask, renderSession); - + renderSession.drawCount++; renderSession.spriteBatch.start(); @@ -12369,20 +12369,20 @@ * Renders the object using the Canvas renderer * * @method _renderCanvas -* @param renderSession {RenderSession} +* @param renderSession {RenderSession} * @private */ PIXI.Graphics.prototype._renderCanvas = function(renderSession) { // if the sprite is not visible or the alpha is 0 then no need to render this element if(this.visible === false || this.alpha === 0 || this.isMask === true)return; - + if(this._cacheAsBitmap) { if(this.dirty || this.cachedSpriteDirty) { this._generateCachedSprite(); - + // we will also need to update the texture this.updateCachedSpriteTexture(); @@ -12399,7 +12399,7 @@ { var context = renderSession.context; var transform = this.worldTransform; - + if(this.blendMode !== renderSession.currentBlendMode) { renderSession.currentBlendMode = this.blendMode; @@ -12535,7 +12535,7 @@ var type = data.type; var lineWidth = data.lineWidth; shape = data.shape; - + if(type === PIXI.Graphics.RECT || type === PIXI.Graphics.RREC) { @@ -12580,7 +12580,7 @@ { // POLY points = shape.points; - + for (var j = 0; j < points.length; j+=2) { @@ -12604,7 +12604,7 @@ } var padding = this.boundsPadding; - + this._localBounds.x = minX - padding; this._localBounds.width = (maxX - minX) + padding * 2; @@ -12626,7 +12626,7 @@ { var canvasBuffer = new PIXI.CanvasBuffer(bounds.width, bounds.height); var texture = PIXI.Texture.fromCanvas(canvasBuffer.canvas); - + this._cachedSprite = new PIXI.Sprite(texture); this._cachedSprite.buffer = canvasBuffer; @@ -12643,8 +12643,8 @@ // this._cachedSprite.buffer.context.save(); this._cachedSprite.buffer.context.translate(-bounds.x,-bounds.y); - - // make sure we set the alpha of the graphics to 1 for the render.. + + // make sure we set the alpha of the graphics to 1 for the render.. this.worldAlpha = 1; // now render the graphic.. @@ -12708,9 +12708,9 @@ this.currentPath = null; var data = new PIXI.GraphicsData(this.lineWidth, this.lineColor, this.lineAlpha, this.fillColor, this.fillAlpha, this.filling, shape); - + this.graphicsData.push(data); - + if(data.type === PIXI.Graphics.POLY) { data.shape.closed = this.filling; @@ -12724,7 +12724,7 @@ /** * A GraphicsData object. - * + * * @class GraphicsData * @constructor */ @@ -12757,7 +12757,7 @@ PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP; PIXI.RoundedRectangle.prototype.type = PIXI.Graphics.RREC; - + /** * @author Mat Groves http://matgroves.com/ */ @@ -13227,7 +13227,7 @@ TRIANGLE_STRIP: 0, TRIANGLES: 1 }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 * @copyright Mat Groves, Rovanion Luckey @@ -13402,7 +13402,7 @@ this.texture = texture; //this.updateFrame = true; }; - + /** * @author Mat Groves http://matgroves.com/ */ @@ -13888,7 +13888,7 @@ this.tilingTexture.destroy(true); this.tilingTexture = null; }; - + /****************************************************************************** * Spine Runtimes Software License * Version 2.1 @@ -16515,7 +16515,7 @@ return this.maxY - this.minY; } }; - + /* Esoteric Software SPINE wrapper for pixi.js */ spine.Bone.yDown = true; @@ -16826,7 +16826,7 @@ return strip; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -16847,13 +16847,13 @@ PIXI.BaseTexture = function(source, scaleMode) { /** - * The Resolution of the texture. + * The Resolution of the texture. * * @property resolution * @type Number */ this.resolution = 1; - + /** * [read-only] The width of the base texture set when the image has loaded * @@ -16874,7 +16874,7 @@ /** * The scale mode to apply when scaling this texture - * + * * @property scaleMode * @type {Number} * @default PIXI.scaleModes.LINEAR @@ -16922,7 +16922,7 @@ * * Set this to true if a mipmap of this texture needs to be generated. This value needs to be set before the texture is used * Also the texture must be a power of two size to work - * + * * @property mipmap * @type {Boolean} */ @@ -17056,7 +17056,7 @@ { gl.deleteTexture(glTexture); } - + } this._glTextures.length = 0; @@ -17132,7 +17132,7 @@ return baseTexture; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -17151,7 +17151,7 @@ * @constructor * @param baseTexture {BaseTexture} The base texture source to create the texture from * @param [frame] {Rectangle} The rectangle frame of the texture to show - * @param [crop] {Rectangle} The area of original texture + * @param [crop] {Rectangle} The area of original texture * @param [trim] {Rectangle} Trimmed texture rectangle */ PIXI.Texture = function(baseTexture, frame, crop, trim) @@ -17327,7 +17327,7 @@ this.frame.width = this.trim.width; this.frame.height = this.trim.height; } - + if (this.valid) this._updateUvs(); }; @@ -17345,7 +17345,7 @@ var frame = this.crop; var tw = this.baseTexture.width; var th = this.baseTexture.height; - + this._uvs.x0 = frame.x / tw; this._uvs.y0 = frame.y / th; @@ -17462,7 +17462,7 @@ PIXI.Texture.emptyTexture = new PIXI.Texture(new PIXI.BaseTexture()); - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -17666,8 +17666,8 @@ { if(!this.valid)return; //TOOD replace position with matrix.. - - //Lets create a nice matrix to apply to our display object. Frame buffers come in upside down so we need to flip the matrix + + //Lets create a nice matrix to apply to our display object. Frame buffers come in upside down so we need to flip the matrix var wt = displayObject.worldTransform; wt.identity(); wt.translate(0, this.projection.y * 2); @@ -17677,14 +17677,14 @@ // setWorld Alpha to ensure that the object is renderer at full opacity displayObject.worldAlpha = 1; - // Time to update all the children of the displayObject with the new matrix.. + // Time to update all the children of the displayObject with the new matrix.. var children = displayObject.children; for(var i=0,j=children.length; i */ @@ -417,7 +417,7 @@ * An array of the points of this polygon * @property points * @type Array(Point)|Array(Number) - * + * */ this.points = points; @@ -471,7 +471,7 @@ // constructor PIXI.Polygon.prototype.constructor = PIXI.Polygon; - + /** * @author Chad Engler */ @@ -563,7 +563,7 @@ // constructor PIXI.Circle.prototype.constructor = PIXI.Circle; - + /** * @author Chad Engler */ @@ -664,7 +664,7 @@ // constructor PIXI.Ellipse.prototype.constructor = PIXI.Ellipse; - + /** * @author Mat Groves http://matgroves.com/ */ @@ -678,7 +678,7 @@ * @param y {Number} The Y coordinate of the upper-left corner of the rounded rectangle * @param width {Number} The overall width of this rounded rectangle * @param height {Number} The overall height of this rounded rectangle - * @param radius {Number} Controls the radius of the rounded corners + * @param radius {Number} Controls the radius of the rounded corners */ PIXI.RoundedRectangle = function(x, y, width, height, radius) { @@ -766,14 +766,14 @@ // constructor PIXI.RoundedRectangle.prototype.constructor = PIXI.RoundedRectangle; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ /** - * The Matrix class is now an object, which makes it a lot faster, - * here is a representation of it : + * The Matrix class is now an object, which makes it a lot faster, + * here is a representation of it : * | a | b | tx| * | c | d | ty| * | 0 | 0 | 1 | @@ -922,7 +922,7 @@ newPos = newPos || new PIXI.Point(); var id = 1 / (this.a * this.d + this.c * -this.b); - + newPos.x = this.d * id * pos.x + -this.c * id * pos.y + (this.ty * this.c - this.tx * this.d) * id; newPos.y = this.a * id * pos.y + -this.b * id * pos.x + (-this.ty * this.a + this.tx * this.b) * id; @@ -931,7 +931,7 @@ /** * Translates the matrix on the x and y. - * + * * @method translate * @param {Number} x * @param {Number} y @@ -941,13 +941,13 @@ { this.tx += x; this.ty += y; - + return this; }; /** * Applies a scale transformation to the matrix. - * + * * @method scale * @param {Number} x The amount to scale horizontally * @param {Number} y The amount to scale vertically @@ -987,13 +987,13 @@ this.d = c1 * sin+this.d * cos; this.tx = tx1 * cos - this.ty * sin; this.ty = tx1 * sin + this.ty * cos; - + return this; }; /** * Appends the given Matrix to this Matrix. - * + * * @method append * @param {Matrix} matrix * @return {Matrix} This matrix. Good for chaining method calls. @@ -1012,13 +1012,13 @@ this.tx = matrix.tx * a1 + matrix.ty * c1 + this.tx; this.ty = matrix.tx * b1 + matrix.ty * d1 + this.ty; - + return this; }; /** * Resets this Matix to an identity (default) matrix. - * + * * @method identity * @return {Matrix} This matrix. Good for chaining method calls. */ @@ -1035,7 +1035,7 @@ }; PIXI.identityMatrix = new PIXI.Matrix(); - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -1254,7 +1254,7 @@ /* * MOUSE Callbacks */ - + /** * A callback that is used when the users mouse rolls over the displayObject * @method mouseover @@ -1515,7 +1515,7 @@ d = this._cr * this.scale.y; tx = this.position.x; ty = this.position.y; - + // check for pivot.. not often used so geared towards that fact! if(this.pivot.x || this.pivot.y) { @@ -1531,7 +1531,7 @@ wt.tx = tx * pt.a + ty * pt.c + pt.tx; wt.ty = tx * pt.b + ty * pt.d + pt.ty; - + } else { @@ -1608,10 +1608,10 @@ var bounds = this.getLocalBounds(); var renderTexture = new PIXI.RenderTexture(bounds.width | 0, bounds.height | 0, renderer, scaleMode, resolution); - + PIXI.DisplayObject._tempMatrix.tx = -bounds.x; PIXI.DisplayObject._tempMatrix.ty = -bounds.y; - + renderTexture.render(this, PIXI.DisplayObject._tempMatrix); return renderTexture; @@ -1651,7 +1651,7 @@ */ PIXI.DisplayObject.prototype.toLocal = function(position, from) { - // + // if (from) { position = from.toGlobal(position); @@ -1714,7 +1714,7 @@ PIXI.DisplayObject._tempMatrix.tx = -bounds.x; PIXI.DisplayObject._tempMatrix.ty = -bounds.y; - + this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix, true); this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); @@ -1801,7 +1801,7 @@ this.position.y = value; } }); - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -1828,7 +1828,7 @@ this.children = []; // fast access to update transform.. - + }; // constructor @@ -1847,7 +1847,7 @@ return this.scale.x * this.getLocalBounds().width; }, set: function(value) { - + var width = this.getLocalBounds().width; if(width !== 0) @@ -1859,7 +1859,7 @@ this.scale.x = 1; } - + this._width = value; } }); @@ -2008,7 +2008,7 @@ throw new Error('getChildAt: Supplied index '+ index +' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); } return this.children[index]; - + }; /** @@ -2022,7 +2022,7 @@ { var index = this.children.indexOf( child ); if(index === -1)return; - + return this.removeChildAt( index ); }; @@ -2130,13 +2130,13 @@ for(var i=0,j=this.children.length; i 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0); }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 * @author Chad Engler https://github.com/englercj @Rolnaaba @@ -5612,7 +5612,7 @@ PIXI.Event.prototype.stopImmediatePropagation = function stopImmediatePropagation() { this.stoppedImmediate = true; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -5627,14 +5627,14 @@ * @static * @param width=800 {Number} the width of the renderers view * @param height=600 {Number} the height of the renderers view - * + * * @param [options] {Object} The optional renderer parameters * @param [options.view] {HTMLCanvasElement} the canvas to use as a view, optional * @param [options.transparent=false] {Boolean} If the render view is transparent, default false * @param [options.antialias=false] {Boolean} sets antialias (only applicable in chrome at the moment) * @param [options.preserveDrawingBuffer=false] {Boolean} enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context * @param [options.resolution=1] {Number} the resolution of the renderer retina would be 2 - * + * */ PIXI.autoDetectRenderer = function(width, height, options) { @@ -5661,22 +5661,22 @@ /** * This helper function will automatically detect which renderer you should be using. * This function is very similar to the autoDetectRenderer function except that is will return a canvas renderer for android. - * Even thought both android chrome supports webGL the canvas implementation perform better at the time of writing. + * Even thought both android chrome supports webGL the canvas implementation perform better at the time of writing. * This function will likely change and update as webGL performance improves on these devices. - * + * * @method autoDetectRecommendedRenderer * @for PIXI * @static * @param width=800 {Number} the width of the renderers view * @param height=600 {Number} the height of the renderers view - * + * * @param [options] {Object} The optional renderer parameters * @param [options.view] {HTMLCanvasElement} the canvas to use as a view, optional * @param [options.transparent=false] {Boolean} If the render view is transparent, default false * @param [options.antialias=false] {Boolean} sets antialias (only applicable in chrome at the moment) * @param [options.preserveDrawingBuffer=false] {Boolean} enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context * @param [options.resolution=1] {Number} the resolution of the renderer retina would be 2 - * + * */ PIXI.autoDetectRecommendedRenderer = function(width, height, options) { @@ -5701,7 +5701,7 @@ return new PIXI.CanvasRenderer(width, height, options); }; - + /* PolyK library url: http://polyk.ivank.net @@ -5870,7 +5870,7 @@ { return ((ay-by)*(cx-bx) + (bx-ax)*(cy-by) >= 0) === sign; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -5959,7 +5959,7 @@ return shaderProgram; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 * @author Richard Davey http://www.photonstorm.com @photonstorm @@ -6348,7 +6348,7 @@ ' vTextureCoord = aTextureCoord;', ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', '}' -]; +]; /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6366,7 +6366,7 @@ * @private */ this._UID = PIXI._UID++; - + /** * @property gl * @type WebGLContext @@ -6436,7 +6436,7 @@ * @type Number */ this.textureCount = 0; - + this.init(); }; @@ -6444,7 +6444,7 @@ /** * Initialises the shader. -* +* * @method init */ PIXI.PixiFastShader.prototype.init = function() @@ -6452,7 +6452,7 @@ var gl = this.gl; var program = PIXI.compileProgram(gl, this.vertexSrc, this.fragmentSrc); - + gl.useProgram(program); // get and store the uniforms for the shader @@ -6472,7 +6472,7 @@ this.aTextureCoord = gl.getAttribLocation(program, 'aTextureCoord'); this.colorAttribute = gl.getAttribLocation(program, 'aColor'); - + // Begin worst hack eva // // WHY??? ONLY on my chrome pixel the line above returns -1 when using filters? @@ -6485,7 +6485,7 @@ } this.attributes = [this.aVertexPosition, this.aPositionCoord, this.aScale, this.aRotation, this.aTextureCoord, this.colorAttribute]; - + // End worst hack eva // this.program = program; @@ -6493,7 +6493,7 @@ /** * Destroys the shader. -* +* * @method destroy */ PIXI.PixiFastShader.prototype.destroy = function() @@ -6504,7 +6504,7 @@ this.attributes = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6522,7 +6522,7 @@ * @private */ this._UID = PIXI._UID++; - + /** * @property gl * @type WebGLContext @@ -6586,7 +6586,7 @@ /** * Initialises the shader. -* +* * @method init */ PIXI.StripShader.prototype.init = function() @@ -6617,7 +6617,7 @@ /** * Destroys the shader. -* +* * @method destroy */ PIXI.StripShader.prototype.destroy = function() @@ -6628,7 +6628,7 @@ this.attribute = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6646,7 +6646,7 @@ * @private */ this._UID = PIXI._UID++; - + /** * @property gl * @type WebGLContext @@ -6705,7 +6705,7 @@ /** * Initialises the shader. -* +* * @method init */ PIXI.PrimitiveShader.prototype.init = function() @@ -6735,7 +6735,7 @@ /** * Destroys the shader. -* +* * @method destroy */ PIXI.PrimitiveShader.prototype.destroy = function() @@ -6746,7 +6746,7 @@ this.attributes = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6805,7 +6805,7 @@ 'uniform mat3 translationMatrix;', 'uniform vec2 projectionVector;', 'uniform vec2 offsetVector;', - + 'uniform vec3 tint;', 'uniform float alpha;', 'uniform vec3 color;', @@ -6827,7 +6827,7 @@ /** * Initialises the shader. -* +* * @method init */ PIXI.ComplexPrimitiveShader.prototype.init = function() @@ -6858,7 +6858,7 @@ /** * Destroys the shader. -* +* * @method destroy */ PIXI.ComplexPrimitiveShader.prototype.destroy = function() @@ -6869,7 +6869,7 @@ this.attribute = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6921,27 +6921,27 @@ // render quad.. gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, ( webGLData.indices.length - 4 ) * 2 ); - + renderSession.stencilManager.popStencil(graphics, webGLData, renderSession); } else { webGLData = webGL.data[i]; - + renderSession.shaderManager.setShader( shader );//activatePrimitiveShader(); shader = renderSession.shaderManager.primitiveShader; gl.uniformMatrix3fv(shader.translationMatrix, false, graphics.worldTransform.toArray(true)); - + gl.uniform1f(shader.flipY, 1); - + gl.uniform2f(shader.projectionVector, projection.x, -projection.y); gl.uniform2f(shader.offsetVector, -offset.x, -offset.y); gl.uniform3fv(shader.tintColor, PIXI.hex2rgb(graphics.tint)); gl.uniform1f(shader.alpha, graphics.worldAlpha); - + gl.bindBuffer(gl.ARRAY_BUFFER, webGLData.buffer); @@ -6989,13 +6989,13 @@ PIXI.WebGLGraphics.graphicsDataPool.push( graphicsData ); } - // clear the array and reset the index.. + // clear the array and reset the index.. webGL.data = []; webGL.lastIndex = 0; } - + var webGLData; - + // loop through the graphics datas and construct each one.. // if the object is a complex fill then the new stencil buffer technique will be used // other wise graphics objects will be pushed into a batch.. @@ -7024,7 +7024,7 @@ if(data.points.length < 6 * 2) { webGLData = PIXI.WebGLGraphics.switchMode(webGL, 0); - + var canDrawUsingSimple = PIXI.WebGLGraphics.buildPoly(data, webGLData); // console.log(canDrawUsingSimple); @@ -7034,7 +7034,7 @@ webGLData = PIXI.WebGLGraphics.switchMode(webGL, 1); PIXI.WebGLGraphics.buildComplexPoly(data, webGLData); } - + } else { @@ -7054,7 +7054,7 @@ else { webGLData = PIXI.WebGLGraphics.switchMode(webGL, 0); - + if(data.type === PIXI.Graphics.RECT) { PIXI.WebGLGraphics.buildRectangle(data, webGLData); @@ -7223,8 +7223,8 @@ var triangles = PIXI.PolyK.Triangulate(recPoints); - // - + // + var i = 0; for (i = 0; i < triangles.length; i+=3) { @@ -7322,7 +7322,7 @@ var y = circleData.y; var width; var height; - + // TODO - bit hacky?? if(graphicsData.type === PIXI.Graphics.CIRC) { @@ -7651,8 +7651,8 @@ maxX, maxY, minX, maxY); - // push a quad onto the end.. - + // push a quad onto the end.. + //TODO - this aint needed! var length = points.length / 2; for (i = 0; i < length; i++) @@ -7766,7 +7766,7 @@ this.dirty = false; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8193,7 +8193,7 @@ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.source); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, texture.scaleMode === PIXI.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST); - + if(texture.mipmap && PIXI.isPowerOfTwo(texture.width, texture.height)) { @@ -8321,7 +8321,7 @@ }; PIXI.WebGLRenderer.glContextId = 0; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8355,8 +8355,8 @@ /** * Sets-up the given blendMode from WebGL's point of view. -* -* @method setBlendMode +* +* @method setBlendMode * @param blendMode {Number} the blendMode, should be a Pixi const, such as PIXI.BlendModes.ADD */ PIXI.WebGLBlendModeManager.prototype.setBlendMode = function(blendMode) @@ -8364,23 +8364,23 @@ if(this.currentBlendMode === blendMode)return false; this.currentBlendMode = blendMode; - + var blendModeWebGL = PIXI.blendModesWebGL[this.currentBlendMode]; this.gl.blendFunc(blendModeWebGL[0], blendModeWebGL[1]); - + return true; }; /** * Destroys this object. -* +* * @method destroy */ PIXI.WebGLBlendModeManager.prototype.destroy = function() { this.gl = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8398,8 +8398,8 @@ /** * Sets the drawing context to the one given in parameter. -* -* @method setContext +* +* @method setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLMaskManager.prototype.setContext = function(gl) @@ -8409,7 +8409,7 @@ /** * Applies the Mask and adds it to the current filter stack. -* +* * @method pushMask * @param maskData {Array} * @param renderSession {Object} @@ -8430,7 +8430,7 @@ /** * Removes the last filter from the filter stack and doesn't return it. -* +* * @method popMask * @param maskData {Array} * @param renderSession {Object} an object containing all the useful parameters @@ -8443,14 +8443,14 @@ /** * Destroys the mask stack. -* +* * @method destroy */ PIXI.WebGLMaskManager.prototype.destroy = function() { this.gl = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8469,8 +8469,8 @@ /** * Sets the drawing context to the one given in parameter. -* -* @method setContext +* +* @method setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLStencilManager.prototype.setContext = function(gl) @@ -8480,7 +8480,7 @@ /** * Applies the Mask and adds it to the current filter stack. -* +* * @method pushMask * @param graphics {Graphics} * @param webGLData {Array} @@ -8513,7 +8513,7 @@ if(webGLData.mode === 1) { gl.drawElements(gl.TRIANGLE_FAN, webGLData.indices.length - 4, gl.UNSIGNED_SHORT, 0 ); - + if(this.reverse) { gl.stencilFunc(gl.EQUAL, 0xFF - level, 0xFF); @@ -8527,7 +8527,7 @@ // draw a quad to increment.. gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, ( webGLData.indices.length - 4 ) * 2 ); - + if(this.reverse) { gl.stencilFunc(gl.EQUAL,0xFF-(level+1), 0xFF); @@ -8572,7 +8572,7 @@ /** * TODO this does not belong here! - * + * * @method bindGraphics * @param graphics {Graphics} * @param webGLData {Array} @@ -8597,7 +8597,7 @@ renderSession.shaderManager.setShader( shader ); gl.uniform1f(shader.flipY, renderSession.flipY); - + gl.uniformMatrix3fv(shader.translationMatrix, false, graphics.worldTransform.toArray(true)); gl.uniform2f(shader.projectionVector, projection.x, -projection.y); @@ -8632,7 +8632,7 @@ gl.uniform3fv(shader.tintColor, PIXI.hex2rgb(graphics.tint)); gl.uniform1f(shader.alpha, graphics.worldAlpha); - + gl.bindBuffer(gl.ARRAY_BUFFER, webGLData.buffer); gl.vertexAttribPointer(shader.aVertexPosition, 2, gl.FLOAT, false, 4 * 6, 0); @@ -8653,7 +8653,7 @@ { var gl = this.gl; this.stencilStack.pop(); - + this.count--; if(this.stencilStack.length === 0) @@ -8670,7 +8670,7 @@ this.bindGraphics(graphics, webGLData, renderSession); gl.colorMask(false, false, false, false); - + if(webGLData.mode === 1) { this.reverse = !this.reverse; @@ -8688,13 +8688,13 @@ // draw a quad to increment.. gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, ( webGLData.indices.length - 4 ) * 2 ); - + gl.stencilFunc(gl.ALWAYS,0,0xFF); gl.stencilOp(gl.KEEP,gl.KEEP,gl.INVERT); // draw the triangle strip! gl.drawElements(gl.TRIANGLE_FAN, webGLData.indices.length - 4, gl.UNSIGNED_SHORT, 0 ); - + if(!this.reverse) { gl.stencilFunc(gl.EQUAL,0xFF-(level), 0xFF); @@ -8740,7 +8740,7 @@ /** * Destroys the mask stack. -* +* * @method destroy */ PIXI.WebGLStencilManager.prototype.destroy = function() @@ -8748,7 +8748,7 @@ this.stencilStack = null; this.gl = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8795,14 +8795,14 @@ /** * Initialises the context and the properties. -* -* @method setContext +* +* @method setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLShaderManager.prototype.setContext = function(gl) { this.gl = gl; - + // the next one is used for rendering primitives this.primitiveShader = new PIXI.PrimitiveShader(gl); @@ -8822,9 +8822,9 @@ /** * Takes the attributes given in parameters. -* +* * @method setAttribs -* @param attribs {Array} attribs +* @param attribs {Array} attribs */ PIXI.WebGLShaderManager.prototype.setAttribs = function(attribs) { @@ -8865,14 +8865,14 @@ /** * Sets the current shader. -* +* * @method setShader * @param shader {Any} */ PIXI.WebGLShaderManager.prototype.setShader = function(shader) { if(this._currentId === shader._UID)return false; - + this._currentId = shader._UID; this.currentShader = shader; @@ -8885,7 +8885,7 @@ /** * Destroys this object. -* +* * @method destroy */ PIXI.WebGLShaderManager.prototype.destroy = function() @@ -8906,14 +8906,14 @@ this.gl = null; }; - + /** * @author Mat Groves - * + * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ * for creating the original pixi version! * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now share 4 bytes on the vertex buffer - * + * * Heavily inspired by LibGDX's WebGLSpriteBatch: * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/WebGLSpriteBatch.java */ @@ -8975,7 +8975,7 @@ * @type Uint16Array */ this.indices = new PIXI.Uint16Array(numIndices); - + /** * @property lastIndexCount * @type Number @@ -9115,7 +9115,7 @@ { var texture = sprite.texture; - //TODO set blend modes.. + //TODO set blend modes.. // check texture.. if(this.currentBatchSize >= this.size) { @@ -9133,7 +9133,7 @@ var aY = sprite.anchor.y; var w0, w1, h0, h1; - + if (texture.trim) { // if the sprite is trimmed then we need to add the extra space before transforming the sprite coords.. @@ -9156,7 +9156,7 @@ } var index = this.currentBatchSize * 4 * this.vertSize; - + var resolution = texture.baseTexture.resolution; var worldTransform = sprite.worldTransform; @@ -9207,7 +9207,7 @@ positions[index+15] = a * w1 + c * h0 + tx; positions[index+16] = d * h0 + b * w1 + ty; } - + // uv positions[index+2] = uvs.x0; positions[index+3] = uvs.y0; @@ -9236,7 +9236,7 @@ /** * Renders a TilingSprite using the spriteBatch. -* +* * @method renderTilingSprite * @param sprite {TilingSprite} the tilingSprite to render */ @@ -9329,7 +9329,7 @@ positions[index++] = uvs.y1; // color colors[index++] = color; - + // xy positions[index++] = a * w0 + c * h0 + tx; positions[index++] = d * h0 + b * w0 + ty; @@ -9386,7 +9386,7 @@ gl.vertexAttribPointer(shader.colorAttribute, 4, gl.UNSIGNED_BYTE, true, stride, 4 * 4); } - // upload the verts to the buffer + // upload the verts to the buffer if(this.currentBatchSize > ( this.size * 0.5 ) ) { gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices); @@ -9410,7 +9410,7 @@ var sprite; for (var i = 0, j = this.currentBatchSize; i < j; i++) { - + sprite = this.sprites[i]; nextTexture = sprite.texture.baseTexture; @@ -9437,7 +9437,7 @@ if( shaderSwap ) { currentShader = nextShader; - + shader = currentShader.shaders[gl.id]; if(!shader) @@ -9455,7 +9455,7 @@ this.renderSession.shaderManager.setShader(shader); if(shader.dirty)shader.syncUniforms(); - + // both thease only need to be set if they are changing.. // set the projection var projection = this.renderSession.projection; @@ -9503,7 +9503,7 @@ // now draw those suckas! gl.drawElements(gl.TRIANGLES, size * 6, gl.UNSIGNED_SHORT, startIndex * 6 * 2); - + // increment the draw count this.renderSession.drawCount++; }; @@ -9527,24 +9527,24 @@ /** * Destroys the SpriteBatch. -* +* * @method destroy */ PIXI.WebGLSpriteBatch.prototype.destroy = function() { this.vertices = null; this.indices = null; - + this.gl.deleteBuffer( this.vertexBuffer ); this.gl.deleteBuffer( this.indexBuffer ); - + this.currentBaseTexture = null; - + this.gl = null; -}; +}; /** * @author Mat Groves - * + * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ * for creating the original pixi version! * @@ -9595,7 +9595,7 @@ * @type Uint16Array */ this.indices = new PIXI.Uint16Array(numIndices); - + /** * @property vertexBuffer * @type Object @@ -9641,7 +9641,7 @@ * @type BaseTexture */ this.currentBaseTexture = null; - + /** * @property currentBlendMode * @type Number @@ -9653,7 +9653,7 @@ * @type Object */ this.renderSession = null; - + /** * @property shader * @type Object @@ -9728,19 +9728,19 @@ var sprite = children[0]; // if the uvs have not updated then no point rendering just yet! - + // check texture. if(!sprite.texture._uvs)return; - + this.currentBaseTexture = sprite.texture.baseTexture; - + // check blend mode if(sprite.blendMode !== this.renderSession.blendModeManager.currentBlendMode) { this.flush(); this.renderSession.blendModeManager.setBlendMode(sprite.blendMode); } - + for(var i=0,j= children.length; i ( this.size * 0.5 ) ) { gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices); @@ -9918,10 +9918,10 @@ gl.bufferSubData(gl.ARRAY_BUFFER, 0, view); } - + // now draw those suckas! gl.drawElements(gl.TRIANGLES, this.currentBatchSize * 6, gl.UNSIGNED_SHORT, 0); - + // then reset the batch! this.currentBatchSize = 0; @@ -9968,9 +9968,9 @@ gl.vertexAttribPointer(this.shader.aRotation, 1, gl.FLOAT, false, stride, 6 * 4); gl.vertexAttribPointer(this.shader.aTextureCoord, 2, gl.FLOAT, false, stride, 7 * 4); gl.vertexAttribPointer(this.shader.colorAttribute, 1, gl.FLOAT, false, stride, 9 * 4); - + }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -9986,7 +9986,7 @@ * @type Array */ this.filterStack = []; - + /** * @property offsetX * @type Number @@ -10004,8 +10004,8 @@ /** * Initialises the context and the properties. -* -* @method setContext +* +* @method setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLFilterManager.prototype.setContext = function(gl) @@ -10018,8 +10018,8 @@ /** * @method begin -* @param renderSession {RenderSession} -* @param buffer {ArrayBuffer} +* @param renderSession {RenderSession} +* @param buffer {ArrayBuffer} */ PIXI.WebGLFilterManager.prototype.begin = function(renderSession, buffer) { @@ -10034,7 +10034,7 @@ /** * Applies the filter and adds it to the current filter stack. -* +* * @method pushFilter * @param filterBlock {Object} the filter that will be pushed to the current filter stack */ @@ -10110,7 +10110,7 @@ /** * Removes the last filter from the filter stack and doesn't return it. -* +* * @method popFilter */ PIXI.WebGLFilterManager.prototype.popFilter = function() @@ -10264,7 +10264,7 @@ // bind the buffer gl.bindFramebuffer(gl.FRAMEBUFFER, buffer ); - // set the blend mode! + // set the blend mode! //gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA) // set texture @@ -10287,7 +10287,7 @@ /** * Applies the filter to the specified area. -* +* * @method applyFilterPass * @param filter {AbstractFilter} the filter that needs to be applied * @param filterArea {Texture} TODO - might need an update @@ -10348,7 +10348,7 @@ /** * Initialises the shader buffers. -* +* * @method initShaderBuffers */ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function() @@ -10396,7 +10396,7 @@ /** * Destroys the filter and removes it from the filter stack. -* +* * @method destroy */ PIXI.WebGLFilterManager.prototype.destroy = function() @@ -10404,7 +10404,7 @@ var gl = this.gl; this.filterStack = null; - + this.offsetX = 0; this.offsetY = 0; @@ -10412,7 +10412,7 @@ for (var i = 0; i < this.texturePool.length; i++) { this.texturePool[i].destroy(); } - + this.texturePool = null; //destroy buffers.. @@ -10421,7 +10421,7 @@ gl.deleteBuffer(this.colorBuffer); gl.deleteBuffer(this.indexBuffer); }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -10476,7 +10476,7 @@ this.renderBuffer = gl.createRenderbuffer(); gl.bindRenderbuffer(gl.RENDERBUFFER, this.renderBuffer); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.renderBuffer); - + this.resize(width, height); }; @@ -10484,13 +10484,13 @@ /** * Clears the filter texture. -* +* * @method clear */ PIXI.FilterTexture.prototype.clear = function() { var gl = this.gl; - + gl.clearColor(0,0,0, 0); gl.clear(gl.COLOR_BUFFER_BIT); }; @@ -10520,7 +10520,7 @@ /** * Destroys the filter texture. -* +* * @method destroy */ PIXI.FilterTexture.prototype.destroy = function() @@ -10532,7 +10532,7 @@ this.frameBuffer = null; this.texture = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -10609,7 +10609,7 @@ this.width = this.canvas.width = width; this.height = this.canvas.height = height; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -10638,7 +10638,7 @@ var context = renderSession.context; context.save(); - + var cacheAlpha = maskData.alpha; var transform = maskData.worldTransform; @@ -10668,7 +10668,7 @@ { renderSession.context.restore(); }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -10685,8 +10685,8 @@ /** * Basically this method just needs a sprite and a color and tints the sprite with the given color. - * - * @method getTintedTexture + * + * @method getTintedTexture * @static * @param sprite {Sprite} the sprite to tint * @param color {Number} the color to use to tint the sprite with @@ -10699,14 +10699,14 @@ color = PIXI.CanvasTinter.roundColor(color); var stringColor = "#" + ("00000" + ( color | 0).toString(16)).substr(-6); - + texture.tintCache = texture.tintCache || {}; if(texture.tintCache[stringColor]) return texture.tintCache[stringColor]; // clone texture.. var canvas = PIXI.CanvasTinter.canvas || document.createElement("canvas"); - + //PIXI.CanvasTinter.tintWithPerPixel(texture, stringColor, canvas); PIXI.CanvasTinter.tintMethod(texture, color, canvas); @@ -10730,7 +10730,7 @@ /** * Tint a texture using the "multiply" operation. - * + * * @method tintWithMultiply * @static * @param texture {Texture} the texture to tint @@ -10747,9 +10747,9 @@ canvas.height = crop.height; context.fillStyle = "#" + ("00000" + ( color | 0).toString(16)).substr(-6); - + context.fillRect(0, 0, crop.width, crop.height); - + context.globalCompositeOperation = "multiply"; context.drawImage(texture.baseTexture.source, @@ -10777,7 +10777,7 @@ /** * Tint a texture using the "overlay" operation. - * + * * @method tintWithOverlay * @static * @param texture {Texture} the texture to tint @@ -10792,7 +10792,7 @@ canvas.width = crop.width; canvas.height = crop.height; - + context.globalCompositeOperation = "copy"; context.fillStyle = "#" + ("00000" + ( color | 0).toString(16)).substr(-6); context.fillRect(0, 0, crop.width, crop.height); @@ -10807,13 +10807,13 @@ 0, crop.width, crop.height); - + //context.globalCompositeOperation = "copy"; }; /** * Tint a texture pixel per pixel. - * + * * @method tintPerPixel * @static * @param texture {Texture} the texture to tint @@ -10828,7 +10828,7 @@ canvas.width = crop.width; canvas.height = crop.height; - + context.globalCompositeOperation = "copy"; context.drawImage(texture.baseTexture.source, crop.x, @@ -10859,7 +10859,7 @@ /** * Rounds the specified color according to the PIXI.CanvasTinter.cacheStepsPerColorChannel. - * + * * @method roundColor * @static * @param color {number} the color to round, should be a hex color @@ -10880,7 +10880,7 @@ /** * Number of steps which will be used as a cap when rounding colors. * - * @property cacheStepsPerColorChannel + * @property cacheStepsPerColorChannel * @type Number * @static */ @@ -10906,12 +10906,12 @@ /** * The tinting method that will be used. - * + * * @method tintMethod * @static */ PIXI.CanvasTinter.tintMethod = PIXI.CanvasTinter.canUseMultiply ? PIXI.CanvasTinter.tintWithMultiply : PIXI.CanvasTinter.tintWithPerPixel; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -11077,7 +11077,7 @@ }; this.mapBlendModes(); - + this.resize(width, height); if("imageSmoothingEnabled" in this.context) @@ -11116,7 +11116,7 @@ this.context.fillStyle = "black"; this.context.clear(); } - + if (this.clearBeforeRender) { if (this.transparent) @@ -11129,7 +11129,7 @@ this.context.fillRect(0, 0, this.width , this.height); } } - + this.renderDisplayObject(stage); // run interaction! @@ -11257,7 +11257,7 @@ } } }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -11290,7 +11290,7 @@ this.updateGraphicsTint(graphics); graphics.dirty = false; } - + for (var i = 0; i < graphics.graphicsData.length; i++) { @@ -11486,9 +11486,9 @@ if(data.type === PIXI.Graphics.POLY) { context.beginPath(); - + var points = shape.points; - + context.moveTo(points[0], points[1]); for (var j=1; j < points.length/2; j++) @@ -11546,7 +11546,7 @@ } else if (data.type === PIXI.Graphics.RREC) { - + var pts = shape.points; var rx = pts[0]; var ry = pts[1]; @@ -11590,7 +11590,7 @@ /* var colorR = (fillColor >> 16 & 0xFF) / 255; var colorG = (fillColor >> 8 & 0xFF) / 255; - var colorB = (fillColor & 0xFF) / 255; + var colorB = (fillColor & 0xFF) / 255; colorR *= tintR; colorG *= tintG; @@ -11600,15 +11600,15 @@ colorR = (lineColor >> 16 & 0xFF) / 255; colorG = (lineColor >> 8 & 0xFF) / 255; - colorB = (lineColor & 0xFF) / 255; + colorB = (lineColor & 0xFF) / 255; colorR *= tintR; colorG *= tintG; colorB *= tintB; - lineColor = ((colorR*255 << 16) + (colorG*255 << 8) + colorB*255); + lineColor = ((colorR*255 << 16) + (colorG*255 << 8) + colorB*255); */ - + // super inline cos im an optimization NAZI :) data._fillTint = (((fillColor >> 16 & 0xFF) / 255 * tintR*255 << 16) + ((fillColor >> 8 & 0xFF) / 255 * tintG*255 << 8) + (fillColor & 0xFF) / 255 * tintB*255); data._lineTint = (((lineColor >> 16 & 0xFF) / 255 * tintR*255 << 16) + ((lineColor >> 8 & 0xFF) / 255 * tintG*255 << 8) + (lineColor & 0xFF) / 255 * tintB*255); @@ -11616,14 +11616,14 @@ } }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and rectangles to the display, and color and fill them. - * + * * @class Graphics * @extends DisplayObjectContainer * @constructor @@ -11685,7 +11685,7 @@ * @default PIXI.blendModes.NORMAL; */ this.blendMode = PIXI.blendModes.NORMAL; - + /** * Current path * @@ -11694,7 +11694,7 @@ * @private */ this.currentPath = null; - + /** * Array containing some WebGL-related properties used by the WebGL renderer. * @@ -11724,7 +11724,7 @@ /** * Used to detect if the graphics object has changed. If this is set to true then the graphics object will be recalculated. - * + * * @property dirty * @type Boolean * @private @@ -11733,7 +11733,7 @@ /** * Used to detect if the webgl graphics object has changed. If this is set to true then the graphics object will be recalculated. - * + * * @property webGLDirty * @type Boolean * @private @@ -11742,7 +11742,7 @@ /** * Used to detect if the cached sprite object needs to be updated. - * + * * @property cachedSpriteDirty * @type Boolean * @private @@ -11815,7 +11815,7 @@ this.currentPath.lineWidth = this.lineWidth; this.currentPath.lineColor = this.lineColor; this.currentPath.lineAlpha = this.lineAlpha; - + } return this; @@ -11880,7 +11880,7 @@ n = 20, points = this.currentPath.shape.points; if(points.length === 0)this.moveTo(0, 0); - + var fromX = points[points.length-2]; var fromY = points[points.length-1]; @@ -11936,7 +11936,7 @@ var fromX = points[points.length-2]; var fromY = points[points.length-1]; - + var j = 0; for (var i=1; i<=n; i++) @@ -11949,11 +11949,11 @@ t2 = j * j; t3 = t2 * j; - + points.push( dt3 * fromX + 3 * dt2 * j * cpX + 3 * dt * t2 * cpX2 + t3 * toX, dt3 * fromY + 3 * dt2 * j * cpY + 3 * dt * t2 * cpY2 + t3 * toY); } - + this.dirty = true; return this; @@ -11961,7 +11961,7 @@ /* * The arcTo() method creates an arc/curve between two tangents on the canvas. - * + * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * * @method arcTo @@ -12066,7 +12066,7 @@ this.moveTo(startX, startY); points = this.currentPath.shape.points; } - + if (startAngle === endAngle)return this; if( !anticlockwise && endAngle <= startAngle ) @@ -12088,7 +12088,7 @@ var cTheta = Math.cos(theta); var sTheta = Math.sin(theta); - + var segMinus = segs - 1; var remainder = ( segMinus % 1 ) / segMinus; @@ -12097,7 +12097,7 @@ { var real = i + remainder * i; - + var angle = ((theta) + startAngle + (theta2 * real)); var c = Math.cos(angle); @@ -12156,7 +12156,7 @@ /** * Draws a rectangle. - * + * * @method drawRect * * @param x {Number} The X coord of the top-left of the rectangle @@ -12174,7 +12174,7 @@ /** * Draws a rounded rectangle. - * + * * @method drawRoundedRect * * @param x {Number} The X coord of the top-left of the rectangle @@ -12270,16 +12270,16 @@ resolution = resolution || 1; var bounds = this.getBounds(); - + var canvasBuffer = new PIXI.CanvasBuffer(bounds.width * resolution, bounds.height * resolution); - + var texture = PIXI.Texture.fromCanvas(canvasBuffer.canvas, scaleMode); texture.baseTexture.resolution = resolution; canvasBuffer.context.scale(resolution, resolution); canvasBuffer.context.translate(-bounds.x,-bounds.y); - + PIXI.CanvasGraphics.renderGraphics(this, canvasBuffer.context); return texture; @@ -12289,7 +12289,7 @@ * Renders the object using the WebGL renderer * * @method _renderWebGL -* @param renderSession {RenderSession} +* @param renderSession {RenderSession} * @private */ PIXI.Graphics.prototype._renderWebGL = function(renderSession) @@ -12304,7 +12304,7 @@ { this._generateCachedSprite(); - + // we will also need to update the texture on the gpu too! this.updateCachedSpriteTexture(); @@ -12324,7 +12324,7 @@ if(this._mask)renderSession.maskManager.pushMask(this._mask, renderSession); if(this._filters)renderSession.filterManager.pushFilter(this._filterBlock); - + // check blend mode if(this.blendMode !== renderSession.spriteBatch.currentBlendMode) { @@ -12332,16 +12332,16 @@ var blendModeWebGL = PIXI.blendModesWebGL[renderSession.spriteBatch.currentBlendMode]; renderSession.spriteBatch.gl.blendFunc(blendModeWebGL[0], blendModeWebGL[1]); } - + // check if the webgl graphic needs to be updated if(this.webGLDirty) { this.dirty = true; this.webGLDirty = false; } - + PIXI.WebGLGraphics.renderGraphics(this, renderSession); - + // only render if it has children! if(this.children.length) { @@ -12358,7 +12358,7 @@ if(this._filters)renderSession.filterManager.popFilter(); if(this._mask)renderSession.maskManager.popMask(this.mask, renderSession); - + renderSession.drawCount++; renderSession.spriteBatch.start(); @@ -12369,20 +12369,20 @@ * Renders the object using the Canvas renderer * * @method _renderCanvas -* @param renderSession {RenderSession} +* @param renderSession {RenderSession} * @private */ PIXI.Graphics.prototype._renderCanvas = function(renderSession) { // if the sprite is not visible or the alpha is 0 then no need to render this element if(this.visible === false || this.alpha === 0 || this.isMask === true)return; - + if(this._cacheAsBitmap) { if(this.dirty || this.cachedSpriteDirty) { this._generateCachedSprite(); - + // we will also need to update the texture this.updateCachedSpriteTexture(); @@ -12399,7 +12399,7 @@ { var context = renderSession.context; var transform = this.worldTransform; - + if(this.blendMode !== renderSession.currentBlendMode) { renderSession.currentBlendMode = this.blendMode; @@ -12535,7 +12535,7 @@ var type = data.type; var lineWidth = data.lineWidth; shape = data.shape; - + if(type === PIXI.Graphics.RECT || type === PIXI.Graphics.RREC) { @@ -12580,7 +12580,7 @@ { // POLY points = shape.points; - + for (var j = 0; j < points.length; j+=2) { @@ -12604,7 +12604,7 @@ } var padding = this.boundsPadding; - + this._localBounds.x = minX - padding; this._localBounds.width = (maxX - minX) + padding * 2; @@ -12626,7 +12626,7 @@ { var canvasBuffer = new PIXI.CanvasBuffer(bounds.width, bounds.height); var texture = PIXI.Texture.fromCanvas(canvasBuffer.canvas); - + this._cachedSprite = new PIXI.Sprite(texture); this._cachedSprite.buffer = canvasBuffer; @@ -12643,8 +12643,8 @@ // this._cachedSprite.buffer.context.save(); this._cachedSprite.buffer.context.translate(-bounds.x,-bounds.y); - - // make sure we set the alpha of the graphics to 1 for the render.. + + // make sure we set the alpha of the graphics to 1 for the render.. this.worldAlpha = 1; // now render the graphic.. @@ -12708,9 +12708,9 @@ this.currentPath = null; var data = new PIXI.GraphicsData(this.lineWidth, this.lineColor, this.lineAlpha, this.fillColor, this.fillAlpha, this.filling, shape); - + this.graphicsData.push(data); - + if(data.type === PIXI.Graphics.POLY) { data.shape.closed = this.filling; @@ -12724,7 +12724,7 @@ /** * A GraphicsData object. - * + * * @class GraphicsData * @constructor */ @@ -12757,7 +12757,7 @@ PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP; PIXI.RoundedRectangle.prototype.type = PIXI.Graphics.RREC; - + /** * @author Mat Groves http://matgroves.com/ */ @@ -13227,7 +13227,7 @@ TRIANGLE_STRIP: 0, TRIANGLES: 1 }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 * @copyright Mat Groves, Rovanion Luckey @@ -13402,7 +13402,7 @@ this.texture = texture; //this.updateFrame = true; }; - + /** * @author Mat Groves http://matgroves.com/ */ @@ -13888,7 +13888,7 @@ this.tilingTexture.destroy(true); this.tilingTexture = null; }; - + /****************************************************************************** * Spine Runtimes Software License * Version 2.1 @@ -16515,7 +16515,7 @@ return this.maxY - this.minY; } }; - + /* Esoteric Software SPINE wrapper for pixi.js */ spine.Bone.yDown = true; @@ -16826,7 +16826,7 @@ return strip; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -16847,13 +16847,13 @@ PIXI.BaseTexture = function(source, scaleMode) { /** - * The Resolution of the texture. + * The Resolution of the texture. * * @property resolution * @type Number */ this.resolution = 1; - + /** * [read-only] The width of the base texture set when the image has loaded * @@ -16874,7 +16874,7 @@ /** * The scale mode to apply when scaling this texture - * + * * @property scaleMode * @type {Number} * @default PIXI.scaleModes.LINEAR @@ -16922,7 +16922,7 @@ * * Set this to true if a mipmap of this texture needs to be generated. This value needs to be set before the texture is used * Also the texture must be a power of two size to work - * + * * @property mipmap * @type {Boolean} */ @@ -17056,7 +17056,7 @@ { gl.deleteTexture(glTexture); } - + } this._glTextures.length = 0; @@ -17132,7 +17132,7 @@ return baseTexture; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -17151,7 +17151,7 @@ * @constructor * @param baseTexture {BaseTexture} The base texture source to create the texture from * @param [frame] {Rectangle} The rectangle frame of the texture to show - * @param [crop] {Rectangle} The area of original texture + * @param [crop] {Rectangle} The area of original texture * @param [trim] {Rectangle} Trimmed texture rectangle */ PIXI.Texture = function(baseTexture, frame, crop, trim) @@ -17327,7 +17327,7 @@ this.frame.width = this.trim.width; this.frame.height = this.trim.height; } - + if (this.valid) this._updateUvs(); }; @@ -17345,7 +17345,7 @@ var frame = this.crop; var tw = this.baseTexture.width; var th = this.baseTexture.height; - + this._uvs.x0 = frame.x / tw; this._uvs.y0 = frame.y / th; @@ -17462,7 +17462,7 @@ PIXI.Texture.emptyTexture = new PIXI.Texture(new PIXI.BaseTexture()); - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -17666,8 +17666,8 @@ { if(!this.valid)return; //TOOD replace position with matrix.. - - //Lets create a nice matrix to apply to our display object. Frame buffers come in upside down so we need to flip the matrix + + //Lets create a nice matrix to apply to our display object. Frame buffers come in upside down so we need to flip the matrix var wt = displayObject.worldTransform; wt.identity(); wt.translate(0, this.projection.y * 2); @@ -17677,14 +17677,14 @@ // setWorld Alpha to ensure that the object is renderer at full opacity displayObject.worldAlpha = 1; - // Time to update all the children of the displayObject with the new matrix.. + // Time to update all the children of the displayObject with the new matrix.. var children = displayObject.children; for(var i=0,j=children.length; i */ @@ -417,7 +417,7 @@ * An array of the points of this polygon * @property points * @type Array(Point)|Array(Number) - * + * */ this.points = points; @@ -471,7 +471,7 @@ // constructor PIXI.Polygon.prototype.constructor = PIXI.Polygon; - + /** * @author Chad Engler */ @@ -563,7 +563,7 @@ // constructor PIXI.Circle.prototype.constructor = PIXI.Circle; - + /** * @author Chad Engler */ @@ -664,7 +664,7 @@ // constructor PIXI.Ellipse.prototype.constructor = PIXI.Ellipse; - + /** * @author Mat Groves http://matgroves.com/ */ @@ -678,7 +678,7 @@ * @param y {Number} The Y coordinate of the upper-left corner of the rounded rectangle * @param width {Number} The overall width of this rounded rectangle * @param height {Number} The overall height of this rounded rectangle - * @param radius {Number} Controls the radius of the rounded corners + * @param radius {Number} Controls the radius of the rounded corners */ PIXI.RoundedRectangle = function(x, y, width, height, radius) { @@ -766,14 +766,14 @@ // constructor PIXI.RoundedRectangle.prototype.constructor = PIXI.RoundedRectangle; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ /** - * The Matrix class is now an object, which makes it a lot faster, - * here is a representation of it : + * The Matrix class is now an object, which makes it a lot faster, + * here is a representation of it : * | a | b | tx| * | c | d | ty| * | 0 | 0 | 1 | @@ -922,7 +922,7 @@ newPos = newPos || new PIXI.Point(); var id = 1 / (this.a * this.d + this.c * -this.b); - + newPos.x = this.d * id * pos.x + -this.c * id * pos.y + (this.ty * this.c - this.tx * this.d) * id; newPos.y = this.a * id * pos.y + -this.b * id * pos.x + (-this.ty * this.a + this.tx * this.b) * id; @@ -931,7 +931,7 @@ /** * Translates the matrix on the x and y. - * + * * @method translate * @param {Number} x * @param {Number} y @@ -941,13 +941,13 @@ { this.tx += x; this.ty += y; - + return this; }; /** * Applies a scale transformation to the matrix. - * + * * @method scale * @param {Number} x The amount to scale horizontally * @param {Number} y The amount to scale vertically @@ -987,13 +987,13 @@ this.d = c1 * sin+this.d * cos; this.tx = tx1 * cos - this.ty * sin; this.ty = tx1 * sin + this.ty * cos; - + return this; }; /** * Appends the given Matrix to this Matrix. - * + * * @method append * @param {Matrix} matrix * @return {Matrix} This matrix. Good for chaining method calls. @@ -1012,13 +1012,13 @@ this.tx = matrix.tx * a1 + matrix.ty * c1 + this.tx; this.ty = matrix.tx * b1 + matrix.ty * d1 + this.ty; - + return this; }; /** * Resets this Matix to an identity (default) matrix. - * + * * @method identity * @return {Matrix} This matrix. Good for chaining method calls. */ @@ -1035,7 +1035,7 @@ }; PIXI.identityMatrix = new PIXI.Matrix(); - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -1254,7 +1254,7 @@ /* * MOUSE Callbacks */ - + /** * A callback that is used when the users mouse rolls over the displayObject * @method mouseover @@ -1515,7 +1515,7 @@ d = this._cr * this.scale.y; tx = this.position.x; ty = this.position.y; - + // check for pivot.. not often used so geared towards that fact! if(this.pivot.x || this.pivot.y) { @@ -1531,7 +1531,7 @@ wt.tx = tx * pt.a + ty * pt.c + pt.tx; wt.ty = tx * pt.b + ty * pt.d + pt.ty; - + } else { @@ -1608,10 +1608,10 @@ var bounds = this.getLocalBounds(); var renderTexture = new PIXI.RenderTexture(bounds.width | 0, bounds.height | 0, renderer, scaleMode, resolution); - + PIXI.DisplayObject._tempMatrix.tx = -bounds.x; PIXI.DisplayObject._tempMatrix.ty = -bounds.y; - + renderTexture.render(this, PIXI.DisplayObject._tempMatrix); return renderTexture; @@ -1651,7 +1651,7 @@ */ PIXI.DisplayObject.prototype.toLocal = function(position, from) { - // + // if (from) { position = from.toGlobal(position); @@ -1714,7 +1714,7 @@ PIXI.DisplayObject._tempMatrix.tx = -bounds.x; PIXI.DisplayObject._tempMatrix.ty = -bounds.y; - + this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix, true); this._cachedSprite.anchor.x = -( bounds.x / bounds.width ); @@ -1801,7 +1801,7 @@ this.position.y = value; } }); - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -1828,7 +1828,7 @@ this.children = []; // fast access to update transform.. - + }; // constructor @@ -1847,7 +1847,7 @@ return this.scale.x * this.getLocalBounds().width; }, set: function(value) { - + var width = this.getLocalBounds().width; if(width !== 0) @@ -1859,7 +1859,7 @@ this.scale.x = 1; } - + this._width = value; } }); @@ -2008,7 +2008,7 @@ throw new Error('getChildAt: Supplied index '+ index +' does not exist in the child list, or the supplied DisplayObject must be a child of the caller'); } return this.children[index]; - + }; /** @@ -2022,7 +2022,7 @@ { var index = this.children.indexOf( child ); if(index === -1)return; - + return this.removeChildAt( index ); }; @@ -2130,13 +2130,13 @@ for(var i=0,j=this.children.length; i 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0); }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 * @author Chad Engler https://github.com/englercj @Rolnaaba @@ -5612,7 +5612,7 @@ PIXI.Event.prototype.stopImmediatePropagation = function stopImmediatePropagation() { this.stoppedImmediate = true; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -5627,14 +5627,14 @@ * @static * @param width=800 {Number} the width of the renderers view * @param height=600 {Number} the height of the renderers view - * + * * @param [options] {Object} The optional renderer parameters * @param [options.view] {HTMLCanvasElement} the canvas to use as a view, optional * @param [options.transparent=false] {Boolean} If the render view is transparent, default false * @param [options.antialias=false] {Boolean} sets antialias (only applicable in chrome at the moment) * @param [options.preserveDrawingBuffer=false] {Boolean} enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context * @param [options.resolution=1] {Number} the resolution of the renderer retina would be 2 - * + * */ PIXI.autoDetectRenderer = function(width, height, options) { @@ -5661,22 +5661,22 @@ /** * This helper function will automatically detect which renderer you should be using. * This function is very similar to the autoDetectRenderer function except that is will return a canvas renderer for android. - * Even thought both android chrome supports webGL the canvas implementation perform better at the time of writing. + * Even thought both android chrome supports webGL the canvas implementation perform better at the time of writing. * This function will likely change and update as webGL performance improves on these devices. - * + * * @method autoDetectRecommendedRenderer * @for PIXI * @static * @param width=800 {Number} the width of the renderers view * @param height=600 {Number} the height of the renderers view - * + * * @param [options] {Object} The optional renderer parameters * @param [options.view] {HTMLCanvasElement} the canvas to use as a view, optional * @param [options.transparent=false] {Boolean} If the render view is transparent, default false * @param [options.antialias=false] {Boolean} sets antialias (only applicable in chrome at the moment) * @param [options.preserveDrawingBuffer=false] {Boolean} enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context * @param [options.resolution=1] {Number} the resolution of the renderer retina would be 2 - * + * */ PIXI.autoDetectRecommendedRenderer = function(width, height, options) { @@ -5701,7 +5701,7 @@ return new PIXI.CanvasRenderer(width, height, options); }; - + /* PolyK library url: http://polyk.ivank.net @@ -5870,7 +5870,7 @@ { return ((ay-by)*(cx-bx) + (bx-ax)*(cy-by) >= 0) === sign; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -5959,7 +5959,7 @@ return shaderProgram; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 * @author Richard Davey http://www.photonstorm.com @photonstorm @@ -6348,7 +6348,7 @@ ' vTextureCoord = aTextureCoord;', ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);', '}' -]; +]; /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6366,7 +6366,7 @@ * @private */ this._UID = PIXI._UID++; - + /** * @property gl * @type WebGLContext @@ -6436,7 +6436,7 @@ * @type Number */ this.textureCount = 0; - + this.init(); }; @@ -6444,7 +6444,7 @@ /** * Initialises the shader. -* +* * @method init */ PIXI.PixiFastShader.prototype.init = function() @@ -6452,7 +6452,7 @@ var gl = this.gl; var program = PIXI.compileProgram(gl, this.vertexSrc, this.fragmentSrc); - + gl.useProgram(program); // get and store the uniforms for the shader @@ -6472,7 +6472,7 @@ this.aTextureCoord = gl.getAttribLocation(program, 'aTextureCoord'); this.colorAttribute = gl.getAttribLocation(program, 'aColor'); - + // Begin worst hack eva // // WHY??? ONLY on my chrome pixel the line above returns -1 when using filters? @@ -6485,7 +6485,7 @@ } this.attributes = [this.aVertexPosition, this.aPositionCoord, this.aScale, this.aRotation, this.aTextureCoord, this.colorAttribute]; - + // End worst hack eva // this.program = program; @@ -6493,7 +6493,7 @@ /** * Destroys the shader. -* +* * @method destroy */ PIXI.PixiFastShader.prototype.destroy = function() @@ -6504,7 +6504,7 @@ this.attributes = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6522,7 +6522,7 @@ * @private */ this._UID = PIXI._UID++; - + /** * @property gl * @type WebGLContext @@ -6586,7 +6586,7 @@ /** * Initialises the shader. -* +* * @method init */ PIXI.StripShader.prototype.init = function() @@ -6617,7 +6617,7 @@ /** * Destroys the shader. -* +* * @method destroy */ PIXI.StripShader.prototype.destroy = function() @@ -6628,7 +6628,7 @@ this.attribute = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6646,7 +6646,7 @@ * @private */ this._UID = PIXI._UID++; - + /** * @property gl * @type WebGLContext @@ -6705,7 +6705,7 @@ /** * Initialises the shader. -* +* * @method init */ PIXI.PrimitiveShader.prototype.init = function() @@ -6735,7 +6735,7 @@ /** * Destroys the shader. -* +* * @method destroy */ PIXI.PrimitiveShader.prototype.destroy = function() @@ -6746,7 +6746,7 @@ this.attributes = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6805,7 +6805,7 @@ 'uniform mat3 translationMatrix;', 'uniform vec2 projectionVector;', 'uniform vec2 offsetVector;', - + 'uniform vec3 tint;', 'uniform float alpha;', 'uniform vec3 color;', @@ -6827,7 +6827,7 @@ /** * Initialises the shader. -* +* * @method init */ PIXI.ComplexPrimitiveShader.prototype.init = function() @@ -6858,7 +6858,7 @@ /** * Destroys the shader. -* +* * @method destroy */ PIXI.ComplexPrimitiveShader.prototype.destroy = function() @@ -6869,7 +6869,7 @@ this.attribute = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -6921,27 +6921,27 @@ // render quad.. gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, ( webGLData.indices.length - 4 ) * 2 ); - + renderSession.stencilManager.popStencil(graphics, webGLData, renderSession); } else { webGLData = webGL.data[i]; - + renderSession.shaderManager.setShader( shader );//activatePrimitiveShader(); shader = renderSession.shaderManager.primitiveShader; gl.uniformMatrix3fv(shader.translationMatrix, false, graphics.worldTransform.toArray(true)); - + gl.uniform1f(shader.flipY, 1); - + gl.uniform2f(shader.projectionVector, projection.x, -projection.y); gl.uniform2f(shader.offsetVector, -offset.x, -offset.y); gl.uniform3fv(shader.tintColor, PIXI.hex2rgb(graphics.tint)); gl.uniform1f(shader.alpha, graphics.worldAlpha); - + gl.bindBuffer(gl.ARRAY_BUFFER, webGLData.buffer); @@ -6989,13 +6989,13 @@ PIXI.WebGLGraphics.graphicsDataPool.push( graphicsData ); } - // clear the array and reset the index.. + // clear the array and reset the index.. webGL.data = []; webGL.lastIndex = 0; } - + var webGLData; - + // loop through the graphics datas and construct each one.. // if the object is a complex fill then the new stencil buffer technique will be used // other wise graphics objects will be pushed into a batch.. @@ -7024,7 +7024,7 @@ if(data.points.length < 6 * 2) { webGLData = PIXI.WebGLGraphics.switchMode(webGL, 0); - + var canDrawUsingSimple = PIXI.WebGLGraphics.buildPoly(data, webGLData); // console.log(canDrawUsingSimple); @@ -7034,7 +7034,7 @@ webGLData = PIXI.WebGLGraphics.switchMode(webGL, 1); PIXI.WebGLGraphics.buildComplexPoly(data, webGLData); } - + } else { @@ -7054,7 +7054,7 @@ else { webGLData = PIXI.WebGLGraphics.switchMode(webGL, 0); - + if(data.type === PIXI.Graphics.RECT) { PIXI.WebGLGraphics.buildRectangle(data, webGLData); @@ -7223,8 +7223,8 @@ var triangles = PIXI.PolyK.Triangulate(recPoints); - // - + // + var i = 0; for (i = 0; i < triangles.length; i+=3) { @@ -7322,7 +7322,7 @@ var y = circleData.y; var width; var height; - + // TODO - bit hacky?? if(graphicsData.type === PIXI.Graphics.CIRC) { @@ -7651,8 +7651,8 @@ maxX, maxY, minX, maxY); - // push a quad onto the end.. - + // push a quad onto the end.. + //TODO - this aint needed! var length = points.length / 2; for (i = 0; i < length; i++) @@ -7766,7 +7766,7 @@ this.dirty = false; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8193,7 +8193,7 @@ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.source); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, texture.scaleMode === PIXI.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST); - + if(texture.mipmap && PIXI.isPowerOfTwo(texture.width, texture.height)) { @@ -8321,7 +8321,7 @@ }; PIXI.WebGLRenderer.glContextId = 0; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8355,8 +8355,8 @@ /** * Sets-up the given blendMode from WebGL's point of view. -* -* @method setBlendMode +* +* @method setBlendMode * @param blendMode {Number} the blendMode, should be a Pixi const, such as PIXI.BlendModes.ADD */ PIXI.WebGLBlendModeManager.prototype.setBlendMode = function(blendMode) @@ -8364,23 +8364,23 @@ if(this.currentBlendMode === blendMode)return false; this.currentBlendMode = blendMode; - + var blendModeWebGL = PIXI.blendModesWebGL[this.currentBlendMode]; this.gl.blendFunc(blendModeWebGL[0], blendModeWebGL[1]); - + return true; }; /** * Destroys this object. -* +* * @method destroy */ PIXI.WebGLBlendModeManager.prototype.destroy = function() { this.gl = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8398,8 +8398,8 @@ /** * Sets the drawing context to the one given in parameter. -* -* @method setContext +* +* @method setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLMaskManager.prototype.setContext = function(gl) @@ -8409,7 +8409,7 @@ /** * Applies the Mask and adds it to the current filter stack. -* +* * @method pushMask * @param maskData {Array} * @param renderSession {Object} @@ -8430,7 +8430,7 @@ /** * Removes the last filter from the filter stack and doesn't return it. -* +* * @method popMask * @param maskData {Array} * @param renderSession {Object} an object containing all the useful parameters @@ -8443,14 +8443,14 @@ /** * Destroys the mask stack. -* +* * @method destroy */ PIXI.WebGLMaskManager.prototype.destroy = function() { this.gl = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8469,8 +8469,8 @@ /** * Sets the drawing context to the one given in parameter. -* -* @method setContext +* +* @method setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLStencilManager.prototype.setContext = function(gl) @@ -8480,7 +8480,7 @@ /** * Applies the Mask and adds it to the current filter stack. -* +* * @method pushMask * @param graphics {Graphics} * @param webGLData {Array} @@ -8513,7 +8513,7 @@ if(webGLData.mode === 1) { gl.drawElements(gl.TRIANGLE_FAN, webGLData.indices.length - 4, gl.UNSIGNED_SHORT, 0 ); - + if(this.reverse) { gl.stencilFunc(gl.EQUAL, 0xFF - level, 0xFF); @@ -8527,7 +8527,7 @@ // draw a quad to increment.. gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, ( webGLData.indices.length - 4 ) * 2 ); - + if(this.reverse) { gl.stencilFunc(gl.EQUAL,0xFF-(level+1), 0xFF); @@ -8572,7 +8572,7 @@ /** * TODO this does not belong here! - * + * * @method bindGraphics * @param graphics {Graphics} * @param webGLData {Array} @@ -8597,7 +8597,7 @@ renderSession.shaderManager.setShader( shader ); gl.uniform1f(shader.flipY, renderSession.flipY); - + gl.uniformMatrix3fv(shader.translationMatrix, false, graphics.worldTransform.toArray(true)); gl.uniform2f(shader.projectionVector, projection.x, -projection.y); @@ -8632,7 +8632,7 @@ gl.uniform3fv(shader.tintColor, PIXI.hex2rgb(graphics.tint)); gl.uniform1f(shader.alpha, graphics.worldAlpha); - + gl.bindBuffer(gl.ARRAY_BUFFER, webGLData.buffer); gl.vertexAttribPointer(shader.aVertexPosition, 2, gl.FLOAT, false, 4 * 6, 0); @@ -8653,7 +8653,7 @@ { var gl = this.gl; this.stencilStack.pop(); - + this.count--; if(this.stencilStack.length === 0) @@ -8670,7 +8670,7 @@ this.bindGraphics(graphics, webGLData, renderSession); gl.colorMask(false, false, false, false); - + if(webGLData.mode === 1) { this.reverse = !this.reverse; @@ -8688,13 +8688,13 @@ // draw a quad to increment.. gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, ( webGLData.indices.length - 4 ) * 2 ); - + gl.stencilFunc(gl.ALWAYS,0,0xFF); gl.stencilOp(gl.KEEP,gl.KEEP,gl.INVERT); // draw the triangle strip! gl.drawElements(gl.TRIANGLE_FAN, webGLData.indices.length - 4, gl.UNSIGNED_SHORT, 0 ); - + if(!this.reverse) { gl.stencilFunc(gl.EQUAL,0xFF-(level), 0xFF); @@ -8740,7 +8740,7 @@ /** * Destroys the mask stack. -* +* * @method destroy */ PIXI.WebGLStencilManager.prototype.destroy = function() @@ -8748,7 +8748,7 @@ this.stencilStack = null; this.gl = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -8795,14 +8795,14 @@ /** * Initialises the context and the properties. -* -* @method setContext +* +* @method setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLShaderManager.prototype.setContext = function(gl) { this.gl = gl; - + // the next one is used for rendering primitives this.primitiveShader = new PIXI.PrimitiveShader(gl); @@ -8822,9 +8822,9 @@ /** * Takes the attributes given in parameters. -* +* * @method setAttribs -* @param attribs {Array} attribs +* @param attribs {Array} attribs */ PIXI.WebGLShaderManager.prototype.setAttribs = function(attribs) { @@ -8865,14 +8865,14 @@ /** * Sets the current shader. -* +* * @method setShader * @param shader {Any} */ PIXI.WebGLShaderManager.prototype.setShader = function(shader) { if(this._currentId === shader._UID)return false; - + this._currentId = shader._UID; this.currentShader = shader; @@ -8885,7 +8885,7 @@ /** * Destroys this object. -* +* * @method destroy */ PIXI.WebGLShaderManager.prototype.destroy = function() @@ -8906,14 +8906,14 @@ this.gl = null; }; - + /** * @author Mat Groves - * + * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ * for creating the original pixi version! * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now share 4 bytes on the vertex buffer - * + * * Heavily inspired by LibGDX's WebGLSpriteBatch: * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/WebGLSpriteBatch.java */ @@ -8975,7 +8975,7 @@ * @type Uint16Array */ this.indices = new PIXI.Uint16Array(numIndices); - + /** * @property lastIndexCount * @type Number @@ -9115,7 +9115,7 @@ { var texture = sprite.texture; - //TODO set blend modes.. + //TODO set blend modes.. // check texture.. if(this.currentBatchSize >= this.size) { @@ -9133,7 +9133,7 @@ var aY = sprite.anchor.y; var w0, w1, h0, h1; - + if (texture.trim) { // if the sprite is trimmed then we need to add the extra space before transforming the sprite coords.. @@ -9156,7 +9156,7 @@ } var index = this.currentBatchSize * 4 * this.vertSize; - + var resolution = texture.baseTexture.resolution; var worldTransform = sprite.worldTransform; @@ -9207,7 +9207,7 @@ positions[index+15] = a * w1 + c * h0 + tx; positions[index+16] = d * h0 + b * w1 + ty; } - + // uv positions[index+2] = uvs.x0; positions[index+3] = uvs.y0; @@ -9236,7 +9236,7 @@ /** * Renders a TilingSprite using the spriteBatch. -* +* * @method renderTilingSprite * @param sprite {TilingSprite} the tilingSprite to render */ @@ -9329,7 +9329,7 @@ positions[index++] = uvs.y1; // color colors[index++] = color; - + // xy positions[index++] = a * w0 + c * h0 + tx; positions[index++] = d * h0 + b * w0 + ty; @@ -9386,7 +9386,7 @@ gl.vertexAttribPointer(shader.colorAttribute, 4, gl.UNSIGNED_BYTE, true, stride, 4 * 4); } - // upload the verts to the buffer + // upload the verts to the buffer if(this.currentBatchSize > ( this.size * 0.5 ) ) { gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices); @@ -9410,7 +9410,7 @@ var sprite; for (var i = 0, j = this.currentBatchSize; i < j; i++) { - + sprite = this.sprites[i]; nextTexture = sprite.texture.baseTexture; @@ -9437,7 +9437,7 @@ if( shaderSwap ) { currentShader = nextShader; - + shader = currentShader.shaders[gl.id]; if(!shader) @@ -9455,7 +9455,7 @@ this.renderSession.shaderManager.setShader(shader); if(shader.dirty)shader.syncUniforms(); - + // both thease only need to be set if they are changing.. // set the projection var projection = this.renderSession.projection; @@ -9503,7 +9503,7 @@ // now draw those suckas! gl.drawElements(gl.TRIANGLES, size * 6, gl.UNSIGNED_SHORT, startIndex * 6 * 2); - + // increment the draw count this.renderSession.drawCount++; }; @@ -9527,24 +9527,24 @@ /** * Destroys the SpriteBatch. -* +* * @method destroy */ PIXI.WebGLSpriteBatch.prototype.destroy = function() { this.vertices = null; this.indices = null; - + this.gl.deleteBuffer( this.vertexBuffer ); this.gl.deleteBuffer( this.indexBuffer ); - + this.currentBaseTexture = null; - + this.gl = null; -}; +}; /** * @author Mat Groves - * + * * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ * for creating the original pixi version! * @@ -9595,7 +9595,7 @@ * @type Uint16Array */ this.indices = new PIXI.Uint16Array(numIndices); - + /** * @property vertexBuffer * @type Object @@ -9641,7 +9641,7 @@ * @type BaseTexture */ this.currentBaseTexture = null; - + /** * @property currentBlendMode * @type Number @@ -9653,7 +9653,7 @@ * @type Object */ this.renderSession = null; - + /** * @property shader * @type Object @@ -9728,19 +9728,19 @@ var sprite = children[0]; // if the uvs have not updated then no point rendering just yet! - + // check texture. if(!sprite.texture._uvs)return; - + this.currentBaseTexture = sprite.texture.baseTexture; - + // check blend mode if(sprite.blendMode !== this.renderSession.blendModeManager.currentBlendMode) { this.flush(); this.renderSession.blendModeManager.setBlendMode(sprite.blendMode); } - + for(var i=0,j= children.length; i ( this.size * 0.5 ) ) { gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices); @@ -9918,10 +9918,10 @@ gl.bufferSubData(gl.ARRAY_BUFFER, 0, view); } - + // now draw those suckas! gl.drawElements(gl.TRIANGLES, this.currentBatchSize * 6, gl.UNSIGNED_SHORT, 0); - + // then reset the batch! this.currentBatchSize = 0; @@ -9968,9 +9968,9 @@ gl.vertexAttribPointer(this.shader.aRotation, 1, gl.FLOAT, false, stride, 6 * 4); gl.vertexAttribPointer(this.shader.aTextureCoord, 2, gl.FLOAT, false, stride, 7 * 4); gl.vertexAttribPointer(this.shader.colorAttribute, 1, gl.FLOAT, false, stride, 9 * 4); - + }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -9986,7 +9986,7 @@ * @type Array */ this.filterStack = []; - + /** * @property offsetX * @type Number @@ -10004,8 +10004,8 @@ /** * Initialises the context and the properties. -* -* @method setContext +* +* @method setContext * @param gl {WebGLContext} the current WebGL drawing context */ PIXI.WebGLFilterManager.prototype.setContext = function(gl) @@ -10018,8 +10018,8 @@ /** * @method begin -* @param renderSession {RenderSession} -* @param buffer {ArrayBuffer} +* @param renderSession {RenderSession} +* @param buffer {ArrayBuffer} */ PIXI.WebGLFilterManager.prototype.begin = function(renderSession, buffer) { @@ -10034,7 +10034,7 @@ /** * Applies the filter and adds it to the current filter stack. -* +* * @method pushFilter * @param filterBlock {Object} the filter that will be pushed to the current filter stack */ @@ -10110,7 +10110,7 @@ /** * Removes the last filter from the filter stack and doesn't return it. -* +* * @method popFilter */ PIXI.WebGLFilterManager.prototype.popFilter = function() @@ -10264,7 +10264,7 @@ // bind the buffer gl.bindFramebuffer(gl.FRAMEBUFFER, buffer ); - // set the blend mode! + // set the blend mode! //gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA) // set texture @@ -10287,7 +10287,7 @@ /** * Applies the filter to the specified area. -* +* * @method applyFilterPass * @param filter {AbstractFilter} the filter that needs to be applied * @param filterArea {Texture} TODO - might need an update @@ -10348,7 +10348,7 @@ /** * Initialises the shader buffers. -* +* * @method initShaderBuffers */ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function() @@ -10396,7 +10396,7 @@ /** * Destroys the filter and removes it from the filter stack. -* +* * @method destroy */ PIXI.WebGLFilterManager.prototype.destroy = function() @@ -10404,7 +10404,7 @@ var gl = this.gl; this.filterStack = null; - + this.offsetX = 0; this.offsetY = 0; @@ -10412,7 +10412,7 @@ for (var i = 0; i < this.texturePool.length; i++) { this.texturePool[i].destroy(); } - + this.texturePool = null; //destroy buffers.. @@ -10421,7 +10421,7 @@ gl.deleteBuffer(this.colorBuffer); gl.deleteBuffer(this.indexBuffer); }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -10476,7 +10476,7 @@ this.renderBuffer = gl.createRenderbuffer(); gl.bindRenderbuffer(gl.RENDERBUFFER, this.renderBuffer); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.renderBuffer); - + this.resize(width, height); }; @@ -10484,13 +10484,13 @@ /** * Clears the filter texture. -* +* * @method clear */ PIXI.FilterTexture.prototype.clear = function() { var gl = this.gl; - + gl.clearColor(0,0,0, 0); gl.clear(gl.COLOR_BUFFER_BIT); }; @@ -10520,7 +10520,7 @@ /** * Destroys the filter texture. -* +* * @method destroy */ PIXI.FilterTexture.prototype.destroy = function() @@ -10532,7 +10532,7 @@ this.frameBuffer = null; this.texture = null; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -10609,7 +10609,7 @@ this.width = this.canvas.width = width; this.height = this.canvas.height = height; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -10638,7 +10638,7 @@ var context = renderSession.context; context.save(); - + var cacheAlpha = maskData.alpha; var transform = maskData.worldTransform; @@ -10668,7 +10668,7 @@ { renderSession.context.restore(); }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -10685,8 +10685,8 @@ /** * Basically this method just needs a sprite and a color and tints the sprite with the given color. - * - * @method getTintedTexture + * + * @method getTintedTexture * @static * @param sprite {Sprite} the sprite to tint * @param color {Number} the color to use to tint the sprite with @@ -10699,14 +10699,14 @@ color = PIXI.CanvasTinter.roundColor(color); var stringColor = "#" + ("00000" + ( color | 0).toString(16)).substr(-6); - + texture.tintCache = texture.tintCache || {}; if(texture.tintCache[stringColor]) return texture.tintCache[stringColor]; // clone texture.. var canvas = PIXI.CanvasTinter.canvas || document.createElement("canvas"); - + //PIXI.CanvasTinter.tintWithPerPixel(texture, stringColor, canvas); PIXI.CanvasTinter.tintMethod(texture, color, canvas); @@ -10730,7 +10730,7 @@ /** * Tint a texture using the "multiply" operation. - * + * * @method tintWithMultiply * @static * @param texture {Texture} the texture to tint @@ -10747,9 +10747,9 @@ canvas.height = crop.height; context.fillStyle = "#" + ("00000" + ( color | 0).toString(16)).substr(-6); - + context.fillRect(0, 0, crop.width, crop.height); - + context.globalCompositeOperation = "multiply"; context.drawImage(texture.baseTexture.source, @@ -10777,7 +10777,7 @@ /** * Tint a texture using the "overlay" operation. - * + * * @method tintWithOverlay * @static * @param texture {Texture} the texture to tint @@ -10792,7 +10792,7 @@ canvas.width = crop.width; canvas.height = crop.height; - + context.globalCompositeOperation = "copy"; context.fillStyle = "#" + ("00000" + ( color | 0).toString(16)).substr(-6); context.fillRect(0, 0, crop.width, crop.height); @@ -10807,13 +10807,13 @@ 0, crop.width, crop.height); - + //context.globalCompositeOperation = "copy"; }; /** * Tint a texture pixel per pixel. - * + * * @method tintPerPixel * @static * @param texture {Texture} the texture to tint @@ -10828,7 +10828,7 @@ canvas.width = crop.width; canvas.height = crop.height; - + context.globalCompositeOperation = "copy"; context.drawImage(texture.baseTexture.source, crop.x, @@ -10859,7 +10859,7 @@ /** * Rounds the specified color according to the PIXI.CanvasTinter.cacheStepsPerColorChannel. - * + * * @method roundColor * @static * @param color {number} the color to round, should be a hex color @@ -10880,7 +10880,7 @@ /** * Number of steps which will be used as a cap when rounding colors. * - * @property cacheStepsPerColorChannel + * @property cacheStepsPerColorChannel * @type Number * @static */ @@ -10906,12 +10906,12 @@ /** * The tinting method that will be used. - * + * * @method tintMethod * @static */ PIXI.CanvasTinter.tintMethod = PIXI.CanvasTinter.canUseMultiply ? PIXI.CanvasTinter.tintWithMultiply : PIXI.CanvasTinter.tintWithPerPixel; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -11077,7 +11077,7 @@ }; this.mapBlendModes(); - + this.resize(width, height); if("imageSmoothingEnabled" in this.context) @@ -11116,7 +11116,7 @@ this.context.fillStyle = "black"; this.context.clear(); } - + if (this.clearBeforeRender) { if (this.transparent) @@ -11129,7 +11129,7 @@ this.context.fillRect(0, 0, this.width , this.height); } } - + this.renderDisplayObject(stage); // run interaction! @@ -11257,7 +11257,7 @@ } } }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -11290,7 +11290,7 @@ this.updateGraphicsTint(graphics); graphics.dirty = false; } - + for (var i = 0; i < graphics.graphicsData.length; i++) { @@ -11486,9 +11486,9 @@ if(data.type === PIXI.Graphics.POLY) { context.beginPath(); - + var points = shape.points; - + context.moveTo(points[0], points[1]); for (var j=1; j < points.length/2; j++) @@ -11546,7 +11546,7 @@ } else if (data.type === PIXI.Graphics.RREC) { - + var pts = shape.points; var rx = pts[0]; var ry = pts[1]; @@ -11590,7 +11590,7 @@ /* var colorR = (fillColor >> 16 & 0xFF) / 255; var colorG = (fillColor >> 8 & 0xFF) / 255; - var colorB = (fillColor & 0xFF) / 255; + var colorB = (fillColor & 0xFF) / 255; colorR *= tintR; colorG *= tintG; @@ -11600,15 +11600,15 @@ colorR = (lineColor >> 16 & 0xFF) / 255; colorG = (lineColor >> 8 & 0xFF) / 255; - colorB = (lineColor & 0xFF) / 255; + colorB = (lineColor & 0xFF) / 255; colorR *= tintR; colorG *= tintG; colorB *= tintB; - lineColor = ((colorR*255 << 16) + (colorG*255 << 8) + colorB*255); + lineColor = ((colorR*255 << 16) + (colorG*255 << 8) + colorB*255); */ - + // super inline cos im an optimization NAZI :) data._fillTint = (((fillColor >> 16 & 0xFF) / 255 * tintR*255 << 16) + ((fillColor >> 8 & 0xFF) / 255 * tintG*255 << 8) + (fillColor & 0xFF) / 255 * tintB*255); data._lineTint = (((lineColor >> 16 & 0xFF) / 255 * tintR*255 << 16) + ((lineColor >> 8 & 0xFF) / 255 * tintG*255 << 8) + (lineColor & 0xFF) / 255 * tintB*255); @@ -11616,14 +11616,14 @@ } }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and rectangles to the display, and color and fill them. - * + * * @class Graphics * @extends DisplayObjectContainer * @constructor @@ -11685,7 +11685,7 @@ * @default PIXI.blendModes.NORMAL; */ this.blendMode = PIXI.blendModes.NORMAL; - + /** * Current path * @@ -11694,7 +11694,7 @@ * @private */ this.currentPath = null; - + /** * Array containing some WebGL-related properties used by the WebGL renderer. * @@ -11724,7 +11724,7 @@ /** * Used to detect if the graphics object has changed. If this is set to true then the graphics object will be recalculated. - * + * * @property dirty * @type Boolean * @private @@ -11733,7 +11733,7 @@ /** * Used to detect if the webgl graphics object has changed. If this is set to true then the graphics object will be recalculated. - * + * * @property webGLDirty * @type Boolean * @private @@ -11742,7 +11742,7 @@ /** * Used to detect if the cached sprite object needs to be updated. - * + * * @property cachedSpriteDirty * @type Boolean * @private @@ -11815,7 +11815,7 @@ this.currentPath.lineWidth = this.lineWidth; this.currentPath.lineColor = this.lineColor; this.currentPath.lineAlpha = this.lineAlpha; - + } return this; @@ -11880,7 +11880,7 @@ n = 20, points = this.currentPath.shape.points; if(points.length === 0)this.moveTo(0, 0); - + var fromX = points[points.length-2]; var fromY = points[points.length-1]; @@ -11936,7 +11936,7 @@ var fromX = points[points.length-2]; var fromY = points[points.length-1]; - + var j = 0; for (var i=1; i<=n; i++) @@ -11949,11 +11949,11 @@ t2 = j * j; t3 = t2 * j; - + points.push( dt3 * fromX + 3 * dt2 * j * cpX + 3 * dt * t2 * cpX2 + t3 * toX, dt3 * fromY + 3 * dt2 * j * cpY + 3 * dt * t2 * cpY2 + t3 * toY); } - + this.dirty = true; return this; @@ -11961,7 +11961,7 @@ /* * The arcTo() method creates an arc/curve between two tangents on the canvas. - * + * * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! * * @method arcTo @@ -12066,7 +12066,7 @@ this.moveTo(startX, startY); points = this.currentPath.shape.points; } - + if (startAngle === endAngle)return this; if( !anticlockwise && endAngle <= startAngle ) @@ -12088,7 +12088,7 @@ var cTheta = Math.cos(theta); var sTheta = Math.sin(theta); - + var segMinus = segs - 1; var remainder = ( segMinus % 1 ) / segMinus; @@ -12097,7 +12097,7 @@ { var real = i + remainder * i; - + var angle = ((theta) + startAngle + (theta2 * real)); var c = Math.cos(angle); @@ -12156,7 +12156,7 @@ /** * Draws a rectangle. - * + * * @method drawRect * * @param x {Number} The X coord of the top-left of the rectangle @@ -12174,7 +12174,7 @@ /** * Draws a rounded rectangle. - * + * * @method drawRoundedRect * * @param x {Number} The X coord of the top-left of the rectangle @@ -12270,16 +12270,16 @@ resolution = resolution || 1; var bounds = this.getBounds(); - + var canvasBuffer = new PIXI.CanvasBuffer(bounds.width * resolution, bounds.height * resolution); - + var texture = PIXI.Texture.fromCanvas(canvasBuffer.canvas, scaleMode); texture.baseTexture.resolution = resolution; canvasBuffer.context.scale(resolution, resolution); canvasBuffer.context.translate(-bounds.x,-bounds.y); - + PIXI.CanvasGraphics.renderGraphics(this, canvasBuffer.context); return texture; @@ -12289,7 +12289,7 @@ * Renders the object using the WebGL renderer * * @method _renderWebGL -* @param renderSession {RenderSession} +* @param renderSession {RenderSession} * @private */ PIXI.Graphics.prototype._renderWebGL = function(renderSession) @@ -12304,7 +12304,7 @@ { this._generateCachedSprite(); - + // we will also need to update the texture on the gpu too! this.updateCachedSpriteTexture(); @@ -12324,7 +12324,7 @@ if(this._mask)renderSession.maskManager.pushMask(this._mask, renderSession); if(this._filters)renderSession.filterManager.pushFilter(this._filterBlock); - + // check blend mode if(this.blendMode !== renderSession.spriteBatch.currentBlendMode) { @@ -12332,16 +12332,16 @@ var blendModeWebGL = PIXI.blendModesWebGL[renderSession.spriteBatch.currentBlendMode]; renderSession.spriteBatch.gl.blendFunc(blendModeWebGL[0], blendModeWebGL[1]); } - + // check if the webgl graphic needs to be updated if(this.webGLDirty) { this.dirty = true; this.webGLDirty = false; } - + PIXI.WebGLGraphics.renderGraphics(this, renderSession); - + // only render if it has children! if(this.children.length) { @@ -12358,7 +12358,7 @@ if(this._filters)renderSession.filterManager.popFilter(); if(this._mask)renderSession.maskManager.popMask(this.mask, renderSession); - + renderSession.drawCount++; renderSession.spriteBatch.start(); @@ -12369,20 +12369,20 @@ * Renders the object using the Canvas renderer * * @method _renderCanvas -* @param renderSession {RenderSession} +* @param renderSession {RenderSession} * @private */ PIXI.Graphics.prototype._renderCanvas = function(renderSession) { // if the sprite is not visible or the alpha is 0 then no need to render this element if(this.visible === false || this.alpha === 0 || this.isMask === true)return; - + if(this._cacheAsBitmap) { if(this.dirty || this.cachedSpriteDirty) { this._generateCachedSprite(); - + // we will also need to update the texture this.updateCachedSpriteTexture(); @@ -12399,7 +12399,7 @@ { var context = renderSession.context; var transform = this.worldTransform; - + if(this.blendMode !== renderSession.currentBlendMode) { renderSession.currentBlendMode = this.blendMode; @@ -12535,7 +12535,7 @@ var type = data.type; var lineWidth = data.lineWidth; shape = data.shape; - + if(type === PIXI.Graphics.RECT || type === PIXI.Graphics.RREC) { @@ -12580,7 +12580,7 @@ { // POLY points = shape.points; - + for (var j = 0; j < points.length; j+=2) { @@ -12604,7 +12604,7 @@ } var padding = this.boundsPadding; - + this._localBounds.x = minX - padding; this._localBounds.width = (maxX - minX) + padding * 2; @@ -12626,7 +12626,7 @@ { var canvasBuffer = new PIXI.CanvasBuffer(bounds.width, bounds.height); var texture = PIXI.Texture.fromCanvas(canvasBuffer.canvas); - + this._cachedSprite = new PIXI.Sprite(texture); this._cachedSprite.buffer = canvasBuffer; @@ -12643,8 +12643,8 @@ // this._cachedSprite.buffer.context.save(); this._cachedSprite.buffer.context.translate(-bounds.x,-bounds.y); - - // make sure we set the alpha of the graphics to 1 for the render.. + + // make sure we set the alpha of the graphics to 1 for the render.. this.worldAlpha = 1; // now render the graphic.. @@ -12708,9 +12708,9 @@ this.currentPath = null; var data = new PIXI.GraphicsData(this.lineWidth, this.lineColor, this.lineAlpha, this.fillColor, this.fillAlpha, this.filling, shape); - + this.graphicsData.push(data); - + if(data.type === PIXI.Graphics.POLY) { data.shape.closed = this.filling; @@ -12724,7 +12724,7 @@ /** * A GraphicsData object. - * + * * @class GraphicsData * @constructor */ @@ -12757,7 +12757,7 @@ PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP; PIXI.RoundedRectangle.prototype.type = PIXI.Graphics.RREC; - + /** * @author Mat Groves http://matgroves.com/ */ @@ -13227,7 +13227,7 @@ TRIANGLE_STRIP: 0, TRIANGLES: 1 }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 * @copyright Mat Groves, Rovanion Luckey @@ -13402,7 +13402,7 @@ this.texture = texture; //this.updateFrame = true; }; - + /** * @author Mat Groves http://matgroves.com/ */ @@ -13888,7 +13888,7 @@ this.tilingTexture.destroy(true); this.tilingTexture = null; }; - + /****************************************************************************** * Spine Runtimes Software License * Version 2.1 @@ -16515,7 +16515,7 @@ return this.maxY - this.minY; } }; - + /* Esoteric Software SPINE wrapper for pixi.js */ spine.Bone.yDown = true; @@ -16826,7 +16826,7 @@ return strip; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -16847,13 +16847,13 @@ PIXI.BaseTexture = function(source, scaleMode) { /** - * The Resolution of the texture. + * The Resolution of the texture. * * @property resolution * @type Number */ this.resolution = 1; - + /** * [read-only] The width of the base texture set when the image has loaded * @@ -16874,7 +16874,7 @@ /** * The scale mode to apply when scaling this texture - * + * * @property scaleMode * @type {Number} * @default PIXI.scaleModes.LINEAR @@ -16922,7 +16922,7 @@ * * Set this to true if a mipmap of this texture needs to be generated. This value needs to be set before the texture is used * Also the texture must be a power of two size to work - * + * * @property mipmap * @type {Boolean} */ @@ -17056,7 +17056,7 @@ { gl.deleteTexture(glTexture); } - + } this._glTextures.length = 0; @@ -17132,7 +17132,7 @@ return baseTexture; }; - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -17151,7 +17151,7 @@ * @constructor * @param baseTexture {BaseTexture} The base texture source to create the texture from * @param [frame] {Rectangle} The rectangle frame of the texture to show - * @param [crop] {Rectangle} The area of original texture + * @param [crop] {Rectangle} The area of original texture * @param [trim] {Rectangle} Trimmed texture rectangle */ PIXI.Texture = function(baseTexture, frame, crop, trim) @@ -17327,7 +17327,7 @@ this.frame.width = this.trim.width; this.frame.height = this.trim.height; } - + if (this.valid) this._updateUvs(); }; @@ -17345,7 +17345,7 @@ var frame = this.crop; var tw = this.baseTexture.width; var th = this.baseTexture.height; - + this._uvs.x0 = frame.x / tw; this._uvs.y0 = frame.y / th; @@ -17462,7 +17462,7 @@ PIXI.Texture.emptyTexture = new PIXI.Texture(new PIXI.BaseTexture()); - + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -17666,8 +17666,8 @@ { if(!this.valid)return; //TOOD replace position with matrix.. - - //Lets create a nice matrix to apply to our display object. Frame buffers come in upside down so we need to flip the matrix + + //Lets create a nice matrix to apply to our display object. Frame buffers come in upside down so we need to flip the matrix var wt = displayObject.worldTransform; wt.identity(); wt.translate(0, this.projection.y * 2); @@ -17677,14 +17677,14 @@ // setWorld Alpha to ensure that the object is renderer at full opacity displayObject.worldAlpha = 1; - // Time to update all the children of the displayObject with the new matrix.. + // Time to update all the children of the displayObject with the new matrix.. var children = displayObject.children; for(var i=0,j=children.length; i