diff --git a/bin/pixi.js b/bin/pixi.js index ee10553..cd497a4 100644 --- a/bin/pixi.js +++ b/bin/pixi.js @@ -8339,7 +8339,7 @@ /** * A simple pool for storing divs. * - * @type {Array} + * @type {*} * @private */ this.pool = []; @@ -8355,7 +8355,7 @@ /** * Setting this to true will visually show the divs * - * @type {Boolean} + * @type {boolean} */ this.debug = false; @@ -8369,7 +8369,7 @@ /** * The array of currently active accessible items. * - * @member {Array} + * @member {*[]} * @private */ this.children = []; @@ -8383,7 +8383,7 @@ /** * stores the state of the manager. If there are no accessible objects or the mouse is moving the will be false. * - * @member {Array} + * @member {*[]} * @private */ this.isActive = false; @@ -8442,7 +8442,7 @@ /** * This recursive function will run throught he scene graph and add any new accessible objects to the DOM layer. - * @param element {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} the DisplayObject to check. + * @param displayObject {PIXI.Container} the DisplayObject to check. * @private */ AccessibilityManager.prototype.updateAccessibleObjects = function(displayObject) @@ -8605,20 +8605,20 @@ } - if(displayObject.accessibleTitle) + if(displayObject.accessibleTitle) { div.title = displayObject.accessibleTitle; - } - else if (!displayObject.accessibleTitle && !displayObject.accessibleHint) + } + else if (!displayObject.accessibleTitle && !displayObject.accessibleHint) { div.title = 'displayObject ' + this.tabIndex; } - if(displayObject.accessibleHint) + if(displayObject.accessibleHint) { - div.setAttribute('aria-label', displayObject.accessibleHint); + div.setAttribute('aria-label', displayObject.accessibleHint); } - + // @@ -9414,8 +9414,8 @@ /** * Removes all children from this container that are within the begin and end indexes. * - * @param beginIndex {number} The beginning position. Default value is 0. - * @param endIndex {number} The ending position. Default value is size of the container. + * @param [beginIndex=0] {number} The beginning position. + * @param [endIndex=this.children.length] {number} The ending position. Default value is size of the container. */ Container.prototype.removeChildren = function (beginIndex, endIndex) { @@ -9576,7 +9576,7 @@ this._currentBounds = null; - return this.getBounds( math.Matrix.IDENTITY ); + return this.getBounds(); }; /** @@ -9687,7 +9687,7 @@ if (this._mask) { - renderer.maskManager.pushMask(this._mask, renderer); + renderer.maskManager.pushMask(this._mask); } this._renderCanvas(renderer); @@ -10061,10 +10061,9 @@ * * Retrieves the bounds of the displayObject as a rectangle object * - * @param matrix {PIXI.Matrix} * @return {PIXI.Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (matrix) // jshint unused:false +DisplayObject.prototype.getBounds = function () // jshint unused:false { return math.Rectangle.EMPTY; }; @@ -10229,12 +10228,13 @@ },{"../math":61,"./Transform":43,"eventemitter3":26}],42:[function(require,module,exports){ /** - * The Point object represents a location in a two-dimensional coordinate system, where x represents - * the horizontal axis and y represents the vertical axis. + * An observable point is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI - * @param transform {PIXI.Transform} the transform object @mat + * + * @param cb {function} The function to be called when the point changes + * @param scope {*} The scope to be applied to the cb * @param [x=0] {number} position of the point on the x axis * @param [y=0] {number} position of the point on the y axis */ @@ -10301,7 +10301,7 @@ this._x = x || 0; this._y = y || ( (y !== 0) ? this._x : 0 ); - this.transform._versionLocal++; + this.transform._versionLocal++; // TODO: Pretty sure this doesn't exist. }; },{}],43:[function(require,module,exports){ @@ -10315,8 +10315,6 @@ * * @class * @memberof PIXI - * @param [x=0] {number} position of the point on the x axis - * @param [y=0] {number} position of the point on the y axis */ function Transform() { @@ -10452,8 +10450,6 @@ * * @class * @memberof PIXI - * @param [x=0] {number} position of the point on the x axis - * @param [y=0] {number} position of the point on the y axis */ function TransformStatic() { @@ -11549,7 +11545,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param shape {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} The shape object to draw. + * @param shape {PIXI.math.Circle|PIXI.math.Ellipse|PIXI.math.Polygon|PIXI.math.Rectangle|PIXI.math.RoundedRectangle} The shape object to draw. * @return {PIXI.GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) @@ -11666,7 +11662,7 @@ * @param fillColor {number} the color of the fill * @param fillAlpha {number} the alpha of the fill * @param fill {boolean} whether or not the shape is filled with a colour - * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + * @param shape {PIXI.math.Circle|PIXI.math.Rectangle|PIXI.math.Ellipse|PIXI.math.Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { @@ -12044,12 +12040,15 @@ /** * Calculate the points for a bezier curve and then draws it. * + * @param fromX {number} Starting point x + * @param fromY {number} Starting point y * @param cpX {number} Control point x * @param cpY {number} Control point y * @param cpX2 {number} Second Control point x * @param cpY2 {number} Second Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y + * @param [path=number[]] Path array to push points into * @return {PIXI.Graphics} */ var bezierCurveTo = function (fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY, path) // jshint ignore:line @@ -12317,7 +12316,9 @@ * * @class * @memberof PIXI - * @param gl {WebGLRenderingContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} The current WebGL drawing context + * @param shader {PIXI.Shader} The shader + * @param attribsState {object} The state for the VAO * @private */ function WebGLGraphicsData(gl, shader, attribsState) @@ -12379,7 +12380,7 @@ .addIndex(this.indexBuffer) .addAttribute(this.buffer, shader.attributes.aVertexPosition, gl.FLOAT, false, 4 * 6, 0) .addAttribute(this.buffer, shader.attributes.aColor, gl.FLOAT, false, 4 * 6, 2 * 4); - + } @@ -12442,7 +12443,7 @@ * @class * @memberof PIXI * @extends PIXI.Shader - * @param shaderManager {ShaderManager} The webgl shader manager this shader works for. + * @param gl {WebGLRenderingContext} The webgl shader manager this shader works for. */ function PrimitiveShader(gl) { @@ -12493,7 +12494,7 @@ * Builds a circle to draw * * @private - * @param graphicsData {PIXI.Graphics} The graphics object to draw + * @param graphicsData {PIXI.WebGLGraphicsData} The graphics object to draw * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ var buildCircle = function (graphicsData, webGLData) @@ -12581,7 +12582,7 @@ * Builds a line to draw * * @private - * @param graphicsData {PIXI.Graphics} The graphics object containing all the necessary properties + * @param graphicsData {PIXI.WebGLGraphicsData} The graphics object containing all the necessary properties * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ var buildLine = function (graphicsData, webGLData) @@ -12793,6 +12794,7 @@ }; module.exports = buildLine; + },{"../../../math":61,"../../../utils":109}],54:[function(require,module,exports){ var buildLine = require('./buildLine'), utils = require('../../../utils'), @@ -12847,8 +12849,6 @@ var vertPos = verts.length / 6; - var i = 0; - for (i = 0; i < triangles.length; i+=3) { indices.push(triangles[i] + vertPos); @@ -12882,7 +12882,7 @@ * Builds a rectangle to draw * * @private - * @param graphicsData {PIXI.Graphics} The graphics object containing all the necessary properties + * @param graphicsData {PIXI.WebGLGraphicsData} The graphics object containing all the necessary properties * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ var buildRectangle = function (graphicsData, webGLData) @@ -12945,6 +12945,7 @@ }; module.exports = buildRectangle; + },{"../../../utils":109,"./buildLine":53}],56:[function(require,module,exports){ var earcut = require('earcut'), buildLine = require('./buildLine'), @@ -12954,7 +12955,7 @@ * Builds a rounded rectangle to draw * * @private - * @param graphicsData {PIXI.Graphics} The graphics object containing all the necessary properties + * @param graphicsData {PIXI.WebGLGraphicsData} The graphics object containing all the necessary properties * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ var buildRoundedRectangle = function (graphicsData, webGLData) @@ -13447,7 +13448,7 @@ * Creates an array from the current Matrix object. * * @param transpose {boolean} Whether we need to transpose the matrix or not - * @param [out] {Array} If provided the array will be assigned to out + * @param [out=Float32Array[]} If provided the array will be assigned to out * @return {number[]} the newly created array which contains the matrix */ Matrix.prototype.toArray = function (transpose, out) @@ -14059,7 +14060,7 @@ /** * @class * @memberof PIXI - * @param points {PIXI.Point[]|number[]|...PIXI.Point|...number} This can be an array of Points that form the polygon, + * @param points_ {PIXI.Point[]|number[]|...PIXI.Point|...number} This can be an array of Points that form the polygon, * a flat array of numbers that will be interpreted as [x,y, x,y, ...], or the arguments passed can be * all the points of the polygon e.g. `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the * arguments passed can be flat x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are @@ -14818,7 +14819,7 @@ // constructor CanvasRenderer.prototype = Object.create(SystemRenderer.prototype); -CanvasRenderer.prototype.constructor = CanvasRenderer; +CanvasRenderer.prototype.constructor = CanvasRenderer; module.exports = CanvasRenderer; utils.pluginTarget.mixin(CanvasRenderer); @@ -14826,7 +14827,11 @@ /** * Renders the object to this canvas view * - * @param object {PIXI.DisplayObject} the object to be rendered + * @param displayObject {PIXI.DisplayObject} The object to be rendered + * @param [renderTexture] {PIXI.RenderTexture} A render texture to be rendered to. If unset, it will render to the root context. + * @param [clear=false] {boolean} Whether to clear the canvas before drawing + * @param [transform] {PIXI.Transform} A transformation to be applied + * @param [skipUpdateTransform=false] {boolean} Whether to skip the update transform */ CanvasRenderer.prototype.render = function (displayObject, renderTexture, clear, transform, skipUpdateTransform) { @@ -14912,9 +14917,9 @@ context.fillStyle = this._backgroundColorString; context.fillRect(0, 0, this.width, this.height); } - } else { + } //else { //TODO: implement background for CanvasRenderTarget or RenderTexture? - } + //} } // TODO RENDER TARGET STUFF HERE.. @@ -14998,7 +15003,6 @@ * This method adds it to the current stack of masks. * * @param maskData {object} the maskData that will be pushed - * @param renderer {PIXI.WebGLRenderer|PIXI.CanvasRenderer} The renderer context to use. */ CanvasMaskManager.prototype.pushMask = function (maskData) { @@ -15151,6 +15155,7 @@ * @memberof PIXI * @param width {number} the width for the newly created canvas * @param height {number} the height for the newly created canvas + * @param [resolution=CONST.RESOLUTION] The resolution of the canvas */ function CanvasRenderTarget(width, height, resolution) { @@ -15487,7 +15492,7 @@ /** * Track textures in the renderer so we can no longer listen to them on destruction. * - * @member {array} + * @member {*[]} * @private */ this._managedTextures = []; @@ -15597,6 +15602,7 @@ * Deletes the texture from WebGL * * @param texture {PIXI.BaseTexture|PIXI.Texture} the texture to destroy + * @param [_skipRemove=false] {boolean} Whether to skip removing the texture from the TextureManager. */ TextureManager.prototype.destroyTexture = function(texture, _skipRemove) { @@ -15748,7 +15754,7 @@ /** * Manages the stencil buffer. * - * @member {PIXI.StencilManager} + * @member {StencilManager} */ this.stencilManager = new StencilManager(this); @@ -15781,7 +15787,7 @@ /** * The currently active ObjectRenderer. * - * @member {PIXI.WebGLState} + * @member {WebGLState} */ this.state = new WebGLState(this.gl); @@ -15858,11 +15864,11 @@ /** * Renders the object to its webGL view * - * @param object {PIXI.DisplayObject} the object to be rendered - * @param renderTexture {PIXI.renderTexture} - * @param clear {Boolean} + * @param displayObject {PIXI.DisplayObject} the object to be rendered + * @param renderTexture {PIXI.RenderTexture} + * @param clear {boolean} * @param transform {PIXI.Transform} - * @param skipUpdateTransform {Boolean} + * @param skipUpdateTransform {boolean} */ WebGLRenderer.prototype.render = function (displayObject, renderTexture, clear, transform, skipUpdateTransform) { @@ -15978,7 +15984,7 @@ /** * Erases the active render target and fills the drawing area with a colour * - * @param clearColor {number} The colour + * @param [clearColor] {number} The colour */ WebGLRenderer.prototype.clear = function (clearColor) { @@ -16254,7 +16260,7 @@ /** * The stack holding all the different states * - * @member {array} + * @member {*[]} * @private */ this.stack = []; @@ -16499,10 +16505,8 @@ * @class * @memberof PIXI * @extends PIXI.Shader - * @param shaderManager {PIXI.ShaderManager} The webgl shader manager this shader works for. * @param [vertexSrc] {string} The source of the vertex shader. - * @param [fragmentSrc] {string} The source of the fragment shader. - * @param [customUniforms] {object} Custom uniforms to use to augment the built-in ones. + * @param [uniforms] {object} Custom uniforms to use to augment the built-in ones. * @param [fragmentSrc] {string} The source of the fragment shader. */ function Filter(vertexSrc, fragmentSrc, uniforms) @@ -16820,7 +16824,7 @@ ); sprite.renderable = false; - + this.maskSprite = sprite; this.maskMatrix = maskMatrix; } @@ -16832,14 +16836,14 @@ /** * Applies the filter * - * @param renderer {PIXI.WebGLRenderer} The renderer to retrieve the filter from + * @param filterManager {PIXI.FilterManager} The renderer to retrieve the filter from * @param input {PIXI.RenderTarget} * @param output {PIXI.RenderTarget} */ SpriteMaskFilter.prototype.apply = function (filterManager, input, output) { var maskSprite = this.maskSprite; - + this.uniforms.mask = maskSprite._texture; this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite ); this.uniforms.alpha = maskSprite.worldAlpha; @@ -17063,7 +17067,7 @@ else if(uniformData[i].type === 'mat3') { // check if its pixi matrix.. - if(uniforms[i].a) + if(uniforms[i].a !== undefined) { shader.uniforms[i] = uniforms[i].toArray(true); } @@ -17075,7 +17079,7 @@ else if(uniformData[i].type === 'vec2') { //check if its a point.. - if(uniforms[i].x) + if(uniforms[i].x !== undefined) { val = shader.uniforms[i]; val[0] = uniforms[i].x; @@ -17213,8 +17217,8 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param graphics {PIXI.Graphics} - * @param webGLData {any[]} + * @param target {PIXI.DisplayObject} + * @param maskData {*[]} */ MaskManager.prototype.pushMask = function (target, maskData) { @@ -17253,8 +17257,8 @@ /** * Removes the last mask from the mask stack and doesn't return it. * - * @param target {PIXI.RenderTarget} - * @param maskData {any[]} + * @param target {PIXI.DisplayObject} + * @param maskData {*[]} */ MaskManager.prototype.popMask = function (target, maskData) { @@ -17280,7 +17284,7 @@ * Applies the Mask and adds it to the current filter stack. * * @param target {PIXI.RenderTarget} - * @param maskData {any[]} + * @param maskData {PIXI.Sprite} */ MaskManager.prototype.pushSpriteMask = function (target, maskData) { @@ -17315,8 +17319,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param target {PIXI.RenderTarget} - * @param maskData {any[]} + * @param maskData {*[]} */ MaskManager.prototype.pushStencilMask = function (maskData) { @@ -17327,8 +17330,6 @@ /** * Removes the last filter from the filter stack and doesn't return it. * - * @param target {PIXI.RenderTarget} - * @param maskData {any[]} */ MaskManager.prototype.popStencilMask = function () { @@ -17385,7 +17386,7 @@ /** * Changes the mask stack that is used by this manager. * - * @param stencilMaskStack {PIXI.StencilMaskStack} The mask stack + * @param stencilMaskStack {PIXI.Graphics[]} The mask stack */ StencilMaskManager.prototype.setMaskStack = function ( stencilMaskStack ) { @@ -17407,7 +17408,6 @@ * Applies the Mask and adds it to the current filter stack. @alvin * * @param graphics {PIXI.Graphics} - * @param webGLData {any[]} */ StencilMaskManager.prototype.pushStencil = function (graphics) { @@ -17439,8 +17439,6 @@ /** * TODO @alvin - * @param graphics {PIXI.Graphics} - * @param webGLData {any[]} */ StencilMaskManager.prototype.popStencil = function () { @@ -17589,6 +17587,7 @@ * @class * @memberof PIXI * @param gl {WebGLRenderingContext} The gl context for this quad to use. + * @param state {object} TODO: Description */ function Quad(gl, state) { @@ -17670,8 +17669,8 @@ /** * Maps two Rectangle to the quad - * @param rect {PIXI.Rectangle} the first rectangle - * @param rect2 {PIXI.Rectangle} the second rectangle + * @param targetTextureFrame {PIXI.Rectangle} the first rectangle + * @param destinationFrame {PIXI.Rectangle} the second rectangle */ Quad.prototype.map = function(targetTextureFrame, destinationFrame) { @@ -17764,11 +17763,11 @@ * @class * @memberof PIXI * @param gl {WebGLRenderingContext} the current WebGL drawing context - * @param width {number} the horizontal range of the filter - * @param height {number} the vertical range of the filter - * @param scaleMode {number} See {@link PIXI.SCALE_MODES} for possible values - * @param resolution {number} the current resolution - * @param root {boolean} Whether this object is the root element or not + * @param [width=0] {number} the horizontal range of the filter + * @param [height=0] {number} the vertical range of the filter + * @param [scaleMode=CONST.SCALE_MODES.DEFAULT] {number} See {@link PIXI.SCALE_MODES} for possible values + * @param [resolution=CONST.RESOLUTION] {number} the current resolution + * @param [root=false] {boolean} Whether this object is the root element or not */ var RenderTarget = function(gl, width, height, scaleMode, resolution, root) { @@ -17786,7 +17785,7 @@ /** * A frame buffer * - * @member {WebGLFrameBuffer} + * @member {glCore.GLFramebuffer} */ this.frameBuffer = null; @@ -17800,7 +17799,7 @@ /** * The background colour of this render target, as an array of [r,g,b,a] values * - * @member {array} + * @member {number[]} */ this.clearColor = [0, 0, 0, 0]; @@ -17842,7 +17841,7 @@ /** * The stencil buffer stores masking data for the render target * - * @member {WebGLRenderBuffer} + * @member {glCore.GLBuffer} */ this.defaultFrame = new math.Rectangle(); this.destinationFrame = null; @@ -17851,14 +17850,14 @@ /** * The stencil buffer stores masking data for the render target * - * @member {WebGLRenderBuffer} + * @member {glCore.GLBuffer} */ this.stencilBuffer = null; /** * The data structure for the stencil masks * - * @member {PIXI.StencilMaskStack} + * @member {PIXI.Graphics[]} */ this.stencilMaskStack = []; @@ -17933,7 +17932,7 @@ /** * Clears the filter texture. * - * @param [bind=false] {boolean} Should we bind our framebuffer before clearing? + * @param [clearColor=this.clearColor] {number[]} Array of [r,g,b,a] to clear the framebuffer */ RenderTarget.prototype.clear = function(clearColor) { @@ -18670,8 +18669,6 @@ * * @static * @param frameId {string} The frame Id of the texture in the cache - * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter - * @param [scaleMode=PIXI.SCALE_MODES.DEFAULT] {number} if you want to specify the scale mode, see {@link PIXI.SCALE_MODES} for possible values * @return {PIXI.Sprite} A new Sprite using a texture from the texture cache matching the frameId */ Sprite.fromFrame = function (frameId) @@ -18692,6 +18689,8 @@ * * @static * @param imageId {string} The image url of the texture + * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter + * @param [scaleMode=PIXI.SCALE_MODES.DEFAULT] {number} if you want to specify the scale mode, see {@link PIXI.SCALE_MODES} for possible values * @return {PIXI.Sprite} A new Sprite using a texture from the texture cache matching the image id */ Sprite.fromImage = function (imageId, crossorigin, scaleMode) @@ -19074,21 +19073,21 @@ /** * Number of steps which will be used as a cap when rounding colors. * - * @member + * @member CanvasTinter */ CanvasTinter.cacheStepsPerColorChannel = 8; /** * Tint cache boolean flag. * - * @member + * @member CanvasTinter */ CanvasTinter.convertTintToImage = false; /** * Whether or not the Canvas BlendModes are supported, consequently the ability to tint using the multiply method. * - * @member + * @member CanvasTinter */ CanvasTinter.canUseMultiply = canUseNewCanvasBlendModes(); @@ -19231,7 +19230,6 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLRenderingContext} the current WebGL drawing context */ SpriteRenderer.prototype.onContextChange = function () { @@ -19992,7 +19990,7 @@ while (index < text.length) { current = characters[index++]; - if (isStroke) + if (isStroke) { this.context.strokeText(current, currentPosition, y); } @@ -20194,21 +20192,21 @@ for (var j = 0; j < words.length; j++) { var wordWidth = this.context.measureText(words[j]).width; - if (this._style.breakWords && wordWidth > wordWrapWidth) + if (this._style.breakWords && wordWidth > wordWrapWidth) { // Word should be split in the middle var characters = words[j].split(''); - for (var c = 0; c < characters.length; c++) + for (var c = 0; c < characters.length; c++) { var characterWidth = this.context.measureText(characters[c]).width; - if (characterWidth > spaceLeft) + if (characterWidth > spaceLeft) { result += '\n' + characters[c]; spaceLeft = wordWrapWidth - characterWidth; - } - else + } + else { - if (c === 0) + if (c === 0) { result += ' '; } @@ -20217,7 +20215,7 @@ } } } - else + else { var wordWidthWithSpace = wordWidth + this.context.measureText(' ').width; if (j === 0 || wordWidthWithSpace > spaceLeft) @@ -20705,7 +20703,6 @@ * * @param width {number} The width to resize to. * @param height {number} The height to resize to. - * @param updateBase {boolean} Should the baseTexture.width and height values be resized as well? */ BaseRenderTexture.prototype.resize = function (width, height) { @@ -20737,7 +20734,6 @@ /** * Destroys this texture * - * @param destroyBase {boolean} Whether to destroy the base texture as well */ BaseRenderTexture.prototype.destroy = function () { @@ -20765,9 +20761,9 @@ * * @class * @memberof PIXI - * @param source {Image|Canvas} the source object of the texture. + * @param [source ]{Image|HTMLCanvasElement} the source object of the texture. * @param [scaleMode=PIXI.SCALE_MODES.DEFAULT] {number} See {@link PIXI.SCALE_MODES} for possible values - * @param resolution {number} the resolution of the texture for devices with different pixel ratios + * @param [resolution=CONST.resolution] {number} the resolution of the texture for devices with different pixel ratios */ function BaseTexture(source, scaleMode, resolution) { @@ -20782,7 +20778,7 @@ * * @member {number} */ - this.resolution = resolution || 1; + this.resolution = resolution || CONST.RESOLUTION; /** * The width of the base texture set when the image has loaded @@ -20853,7 +20849,7 @@ * * TODO: Make this a setter that calls loadSource(); * - * @member {Image|Canvas} + * @member {Image|HTMLCanvasElement} * @readonly */ this.source = null; // set in loadSource, if at all @@ -20976,7 +20972,7 @@ * } * * @protected - * @param source {Image|Canvas} the source object of the texture. + * @param source {Image|HTMLCanvasElement} the source object of the texture. */ BaseTexture.prototype.loadSource = function (source) { @@ -21180,7 +21176,7 @@ * Helper function that creates a base texture from the given canvas element. * * @static - * @param canvas {Canvas} The canvas element source of the texture + * @param canvas {HTMLCanvasElement} The canvas element source of the texture * @param scaleMode {number} See {@link PIXI.SCALE_MODES} for possible values * @return PIXI.BaseTexture */ @@ -21243,6 +21239,7 @@ * @extends PIXI.Texture * @memberof PIXI * @param baseRenderTexture {PIXI.BaseRenderTexture} The renderer used for this RenderTexture + * @param [frame] {PIXI.Rectangle} The rectangle frame of the texture to show */ function RenderTexture(baseRenderTexture, frame) { @@ -21292,7 +21289,7 @@ * * @param width {number} The width to resize to. * @param height {number} The height to resize to. - * @param updateBase {boolean} Should the baseTexture.width and height values be resized as well? + * @param doNotResizeBaseTexture {boolean} Should the baseTexture.width and height values be resized as well? */ RenderTexture.prototype.resize = function (width, height, doNotResizeBaseTexture) { @@ -21635,7 +21632,7 @@ /** * Updates the internal WebGL UV cache. * - * @private + * @protected */ Texture.prototype._updateUvs = function () { @@ -21653,8 +21650,8 @@ * * @static * @param imageUrl {string} The image url of the texture - * @param crossorigin {boolean} Whether requests should be treated as crossorigin - * @param scaleMode {number} See {@link PIXI.SCALE_MODES} for possible values + * @param [crossorigin] {boolean} Whether requests should be treated as crossorigin + * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values * @return {PIXI.Texture} The newly created texture */ Texture.fromImage = function (imageUrl, crossorigin, scaleMode) @@ -21694,8 +21691,8 @@ * Helper function that creates a new Texture based on the given canvas element. * * @static - * @param canvas {Canvas} The canvas element source of the texture - * @param scaleMode {number} See {@link PIXI.SCALE_MODES} for possible values + * @param canvas {HTMLCanvasElement} The canvas element source of the texture + * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values * @return {PIXI.Texture} */ Texture.fromCanvas = function (canvas, scaleMode) @@ -21707,8 +21704,8 @@ * Helper function that creates a new Texture based on the given video element. * * @static - * @param video {HTMLVideoElement} - * @param scaleMode {number} See {@link PIXI.SCALE_MODES} for possible values + * @param video {HTMLVideoElement|string} The URL or actual element of the video + * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values * @return {PIXI.Texture} A Texture */ Texture.fromVideo = function (video, scaleMode) @@ -21728,7 +21725,7 @@ * * @static * @param videoUrl {string} - * @param scaleMode {number} See {@link PIXI.SCALE_MODES} for possible values + * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values * @return {PIXI.Texture} A Texture */ Texture.fromVideoUrl = function (videoUrl, scaleMode) @@ -21818,7 +21815,7 @@ * @constant */ Texture.EMPTY = new Texture(new BaseTexture()); -Texture.EMPTY.destroy = function() {} +Texture.EMPTY.destroy = function() {}; Texture.EMPTY.on = function() {}; Texture.EMPTY.once = function() {}; Texture.EMPTY.emit = function() {}; @@ -22290,7 +22287,6 @@ * {@link PIXI.ticker.Ticker#speed}, which is specific * to scaling {@link PIXI.ticker.Ticker#deltaTime}. * - * @member * @memberof PIXI.ticker.Ticker# * @readonly */ @@ -22309,7 +22305,6 @@ * When setting this property it is clamped to a value between * `0` and `PIXI.TARGET_FPMS * 1000`. * - * @member * @memberof PIXI.ticker.Ticker# * @default 10 */ @@ -22599,7 +22594,7 @@ * Nipped from the resource loader! * @private * @param url {string} The url to test. - * @param [location=window.location] {object} The location object to test against. + * @param loc [location=window.location] {object} The location object to test against. * @return {string} The crossOrigin value to use (or empty string for none). */ var determineCrossOrigin = function (url, loc) { @@ -22632,6 +22627,7 @@ }; module.exports = determineCrossOrigin; + },{"url":24}],109:[function(require,module,exports){ var CONST = require('../const'); @@ -22807,7 +22803,7 @@ /** * removeItems * - * @param {array} arr The target array + * @param {*[]} arr The target array * @param {number} startIdx The index to begin removing from (inclusive) * @param {number} removeCount How many items to remove */ @@ -22925,7 +22921,7 @@ /** * Mixes in the properties of the pluginTarget into another object * - * @param object {object} The obj to mix into + * @param obj {object} The obj to mix into */ mixin: function mixin(obj) { @@ -23492,7 +23488,7 @@ /** * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included). - * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @param renderTexture {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer * @return {Uint8ClampedArray} */ WebGLExtract.prototype.pixels = function ( renderTexture ) @@ -23667,7 +23663,7 @@ /** * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included). - * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @param renderTexture {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer * @return {Uint8ClampedArray} */ Extract.prototype.pixels = function ( renderTexture ) @@ -23888,7 +23884,7 @@ /** * The font descriptor of the BitmapText object * - * @member {Font} + * @member {string|object} * @memberof PIXI.extras.BitmapText# */ font: { @@ -24113,7 +24109,6 @@ },{"../core":57}],117:[function(require,module,exports){ var core = require('../core'); - /** * A MovieClip is a simple way to display an animation depicted by a list of textures. * @@ -24130,12 +24125,15 @@ * var mc = new PIXI.MovieClip(textureArray); * ``` * + * @typedef FrameObject + * @type {object} + * @property texture {PIXI.Texture} The {@link PIXI.Texture} of the frame + * @property time {number} the duration of the frame in ms + * * @class * @extends PIXI.Sprite * @memberof PIXI.extras - * @param textures {PIXI.Texture[]|Object[]} an array of {@link PIXI.Texture} or frame objects that make up the animation - * @param textures[].texture {PIXI.Texture} the {@link PIXI.Texture} of the frame - * @param textures[].time {number} the duration of the frame in ms + * @param textures {PIXI.Texture[]|FrameObject[]} an array of {@link PIXI.Texture} or frame objects that make up the animation */ function MovieClip(textures) { @@ -24431,6 +24429,7 @@ return new MovieClip(textures); }; + },{"../core":57}],118:[function(require,module,exports){ var core = require('../core'), tempPoint = new core.Point(), @@ -24443,7 +24442,7 @@ * @class * @extends PIXI.Sprite * @memberof PIXI.extras - * @param texture {Texture} the texture of the tiling sprite + * @param texture {PIXI.Texture} the texture of the tiling sprite * @param width {number} the width of the tiling sprite * @param height {number} the height of the tiling sprite */ @@ -24998,7 +24997,7 @@ // this renderTexture will be used to store the cached DisplayObject - var renderTexture = new core.RenderTexture.create(bounds.width | 0, bounds.height | 0); + var renderTexture = core.RenderTexture.create(bounds.width | 0, bounds.height | 0); // need to set // var m = _tempMatrix; @@ -25227,7 +25226,7 @@ * @class * @extends PIXI.Shader * @memberof PIXI.mesh - * @param shaderManager {PIXI.ShaderManager} The WebGL shader manager this shader works for. + * @param gl {PIXI.Shader} The WebGL shader manager this shader works for. */ function TilingShader(gl) { @@ -25954,8 +25953,8 @@ * Set the saturation matrix, increase the separation between colors * Increase saturation : increase contrast, brightness, and sharpness * - * @param amount {number} - * @param multiply {boolean} refer to ._loadMatrix() method + * @param [amount=0] {number} + * @param [multiply] {boolean} refer to ._loadMatrix() method */ ColorMatrixFilter.prototype.saturate = function (amount, multiply) { @@ -25977,9 +25976,8 @@ * * Call the saturate function * - * @param multiply {boolean} refer to ._loadMatrix() method */ -ColorMatrixFilter.prototype.desaturate = function (multiply) // jshint unused:false +ColorMatrixFilter.prototype.desaturate = function () // jshint unused:false { this.saturate(-1); }; @@ -26264,7 +26262,8 @@ * @class * @extends PIXI.Filter * @memberof PIXI.filters - * @param sprite {PIXI.Sprite} the sprite used for the displacement map. (make sure its added to the scene!) + * @param sprite {PIXI.Sprite} The sprite used for the displacement map. (make sure its added to the scene!) + * @param scale {number} The scale of the displacement */ function DisplacementFilter(sprite, scale) { @@ -27057,10 +27056,11 @@ * This function is provides a neat way of crawling through the scene graph and running a specified function on all interactive objects it finds. * It will also take care of hit testing the interactive objects and passes the hit across in the function. * - * @param {PIXI.Point} point the point that is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject the displayObject that will be hit test (recurcsivly crawls its children) - * @param {Function} func the function that will be called on each interactive object. The displayObject and hit will be passed to the function - * @param {boolean} hitTest this indicates if the objects inside should be hit test against the point + * @param point {PIXI.Point} the point that is tested for collision + * @param displayObject {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} the displayObject that will be hit test (recurcsivly crawls its children) + * @param [func] {Function} the function that will be called on each interactive object. The displayObject and hit will be passed to the function + * @param [hitTest] {boolean} this indicates if the objects inside should be hit test against the point + * @param [interactive] {boolean} Whether the displayObject is interactive * @return {boolean} returns true if the displayObject hit the point */ InteractionManager.prototype.processInteractive = function (point, displayObject, func, hitTest, interactive) @@ -27162,6 +27162,7 @@ { displayObject.worldTransform.applyInverse(point, this._tempPoint); hit = displayObject.hitArea.contains( this._tempPoint.x, this._tempPoint.y ); + } else if(displayObject.containsPoint) { @@ -27548,7 +27549,7 @@ /** * Grabs an interaction data object from the internal pool * - * @param touchEvent {EventData} The touch event we need to pair with an interactionData object + * @param touchEvent {object} The touch event we need to pair with an interactionData object * * @private */ @@ -27908,7 +27909,7 @@ * ``` * * @class - * @extends PIXI.ResourceLoader + * @extends module:resource-loader.ResourceLoader * @memberof PIXI.loaders * @param [baseUrl=''] {string} The base url for all resources loaded by this loader. * @param [concurrency=10] {number} The number of resources to load concurrently. @@ -28497,7 +28498,6 @@ /** * When the texture is updated, this event will fire to update the scale and frame * - * @param event * @private */ Mesh.prototype._onTextureUpdate = function () @@ -28508,7 +28508,7 @@ /** * Returns the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * - * @param matrix {PIXI.Matrix} the transformation matrix of the sprite + * @param [matrix=this.worldTransform] {PIXI.Matrix} the transformation matrix of the sprite * @return {PIXI.Rectangle} the framing rectangle */ Mesh.prototype.getBounds = function (matrix) @@ -28989,7 +28989,7 @@ * @class * @extends PIXI.Shader * @memberof PIXI.mesh - * @param shaderManager {PIXI.ShaderManager} The WebGL shader manager this shader works for. + * @param gl {Shader} TODO: Find a good explanation for this. */ function MeshShader(gl) { @@ -29350,7 +29350,6 @@ /** * Destroys the container * - * @param [destroyChildren=false] {boolean} if set to true, all the children will have their destroy method called as well */ ParticleContainer.prototype.destroy = function () { core.Container.prototype.destroy.apply(this, arguments); @@ -30039,9 +30038,9 @@ /** * @class - * @extends PIXI.TextureShader + * @extends PIXI.Shader * @memberof PIXI - * @param shaderManager {ShaderManager} The webgl shader manager this shader works for. + * @param gl {PIXI.Shader} The webgl shader manager this shader works for. */ function ParticleShader(gl) { diff --git a/bin/pixi.js b/bin/pixi.js index ee10553..cd497a4 100644 --- a/bin/pixi.js +++ b/bin/pixi.js @@ -8339,7 +8339,7 @@ /** * A simple pool for storing divs. * - * @type {Array} + * @type {*} * @private */ this.pool = []; @@ -8355,7 +8355,7 @@ /** * Setting this to true will visually show the divs * - * @type {Boolean} + * @type {boolean} */ this.debug = false; @@ -8369,7 +8369,7 @@ /** * The array of currently active accessible items. * - * @member {Array} + * @member {*[]} * @private */ this.children = []; @@ -8383,7 +8383,7 @@ /** * stores the state of the manager. If there are no accessible objects or the mouse is moving the will be false. * - * @member {Array} + * @member {*[]} * @private */ this.isActive = false; @@ -8442,7 +8442,7 @@ /** * This recursive function will run throught he scene graph and add any new accessible objects to the DOM layer. - * @param element {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} the DisplayObject to check. + * @param displayObject {PIXI.Container} the DisplayObject to check. * @private */ AccessibilityManager.prototype.updateAccessibleObjects = function(displayObject) @@ -8605,20 +8605,20 @@ } - if(displayObject.accessibleTitle) + if(displayObject.accessibleTitle) { div.title = displayObject.accessibleTitle; - } - else if (!displayObject.accessibleTitle && !displayObject.accessibleHint) + } + else if (!displayObject.accessibleTitle && !displayObject.accessibleHint) { div.title = 'displayObject ' + this.tabIndex; } - if(displayObject.accessibleHint) + if(displayObject.accessibleHint) { - div.setAttribute('aria-label', displayObject.accessibleHint); + div.setAttribute('aria-label', displayObject.accessibleHint); } - + // @@ -9414,8 +9414,8 @@ /** * Removes all children from this container that are within the begin and end indexes. * - * @param beginIndex {number} The beginning position. Default value is 0. - * @param endIndex {number} The ending position. Default value is size of the container. + * @param [beginIndex=0] {number} The beginning position. + * @param [endIndex=this.children.length] {number} The ending position. Default value is size of the container. */ Container.prototype.removeChildren = function (beginIndex, endIndex) { @@ -9576,7 +9576,7 @@ this._currentBounds = null; - return this.getBounds( math.Matrix.IDENTITY ); + return this.getBounds(); }; /** @@ -9687,7 +9687,7 @@ if (this._mask) { - renderer.maskManager.pushMask(this._mask, renderer); + renderer.maskManager.pushMask(this._mask); } this._renderCanvas(renderer); @@ -10061,10 +10061,9 @@ * * Retrieves the bounds of the displayObject as a rectangle object * - * @param matrix {PIXI.Matrix} * @return {PIXI.Rectangle} the rectangular bounding area */ -DisplayObject.prototype.getBounds = function (matrix) // jshint unused:false +DisplayObject.prototype.getBounds = function () // jshint unused:false { return math.Rectangle.EMPTY; }; @@ -10229,12 +10228,13 @@ },{"../math":61,"./Transform":43,"eventemitter3":26}],42:[function(require,module,exports){ /** - * The Point object represents a location in a two-dimensional coordinate system, where x represents - * the horizontal axis and y represents the vertical axis. + * An observable point is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI - * @param transform {PIXI.Transform} the transform object @mat + * + * @param cb {function} The function to be called when the point changes + * @param scope {*} The scope to be applied to the cb * @param [x=0] {number} position of the point on the x axis * @param [y=0] {number} position of the point on the y axis */ @@ -10301,7 +10301,7 @@ this._x = x || 0; this._y = y || ( (y !== 0) ? this._x : 0 ); - this.transform._versionLocal++; + this.transform._versionLocal++; // TODO: Pretty sure this doesn't exist. }; },{}],43:[function(require,module,exports){ @@ -10315,8 +10315,6 @@ * * @class * @memberof PIXI - * @param [x=0] {number} position of the point on the x axis - * @param [y=0] {number} position of the point on the y axis */ function Transform() { @@ -10452,8 +10450,6 @@ * * @class * @memberof PIXI - * @param [x=0] {number} position of the point on the x axis - * @param [y=0] {number} position of the point on the y axis */ function TransformStatic() { @@ -11549,7 +11545,7 @@ /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * - * @param shape {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} The shape object to draw. + * @param shape {PIXI.math.Circle|PIXI.math.Ellipse|PIXI.math.Polygon|PIXI.math.Rectangle|PIXI.math.RoundedRectangle} The shape object to draw. * @return {PIXI.GraphicsData} The generated GraphicsData object. */ Graphics.prototype.drawShape = function (shape) @@ -11666,7 +11662,7 @@ * @param fillColor {number} the color of the fill * @param fillAlpha {number} the alpha of the fill * @param fill {boolean} whether or not the shape is filled with a colour - * @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + * @param shape {PIXI.math.Circle|PIXI.math.Rectangle|PIXI.math.Ellipse|PIXI.math.Polygon} The shape object to draw. */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { @@ -12044,12 +12040,15 @@ /** * Calculate the points for a bezier curve and then draws it. * + * @param fromX {number} Starting point x + * @param fromY {number} Starting point y * @param cpX {number} Control point x * @param cpY {number} Control point y * @param cpX2 {number} Second Control point x * @param cpY2 {number} Second Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y + * @param [path=number[]] Path array to push points into * @return {PIXI.Graphics} */ var bezierCurveTo = function (fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY, path) // jshint ignore:line @@ -12317,7 +12316,9 @@ * * @class * @memberof PIXI - * @param gl {WebGLRenderingContext} the current WebGL drawing context + * @param gl {WebGLRenderingContext} The current WebGL drawing context + * @param shader {PIXI.Shader} The shader + * @param attribsState {object} The state for the VAO * @private */ function WebGLGraphicsData(gl, shader, attribsState) @@ -12379,7 +12380,7 @@ .addIndex(this.indexBuffer) .addAttribute(this.buffer, shader.attributes.aVertexPosition, gl.FLOAT, false, 4 * 6, 0) .addAttribute(this.buffer, shader.attributes.aColor, gl.FLOAT, false, 4 * 6, 2 * 4); - + } @@ -12442,7 +12443,7 @@ * @class * @memberof PIXI * @extends PIXI.Shader - * @param shaderManager {ShaderManager} The webgl shader manager this shader works for. + * @param gl {WebGLRenderingContext} The webgl shader manager this shader works for. */ function PrimitiveShader(gl) { @@ -12493,7 +12494,7 @@ * Builds a circle to draw * * @private - * @param graphicsData {PIXI.Graphics} The graphics object to draw + * @param graphicsData {PIXI.WebGLGraphicsData} The graphics object to draw * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ var buildCircle = function (graphicsData, webGLData) @@ -12581,7 +12582,7 @@ * Builds a line to draw * * @private - * @param graphicsData {PIXI.Graphics} The graphics object containing all the necessary properties + * @param graphicsData {PIXI.WebGLGraphicsData} The graphics object containing all the necessary properties * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ var buildLine = function (graphicsData, webGLData) @@ -12793,6 +12794,7 @@ }; module.exports = buildLine; + },{"../../../math":61,"../../../utils":109}],54:[function(require,module,exports){ var buildLine = require('./buildLine'), utils = require('../../../utils'), @@ -12847,8 +12849,6 @@ var vertPos = verts.length / 6; - var i = 0; - for (i = 0; i < triangles.length; i+=3) { indices.push(triangles[i] + vertPos); @@ -12882,7 +12882,7 @@ * Builds a rectangle to draw * * @private - * @param graphicsData {PIXI.Graphics} The graphics object containing all the necessary properties + * @param graphicsData {PIXI.WebGLGraphicsData} The graphics object containing all the necessary properties * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ var buildRectangle = function (graphicsData, webGLData) @@ -12945,6 +12945,7 @@ }; module.exports = buildRectangle; + },{"../../../utils":109,"./buildLine":53}],56:[function(require,module,exports){ var earcut = require('earcut'), buildLine = require('./buildLine'), @@ -12954,7 +12955,7 @@ * Builds a rounded rectangle to draw * * @private - * @param graphicsData {PIXI.Graphics} The graphics object containing all the necessary properties + * @param graphicsData {PIXI.WebGLGraphicsData} The graphics object containing all the necessary properties * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ var buildRoundedRectangle = function (graphicsData, webGLData) @@ -13447,7 +13448,7 @@ * Creates an array from the current Matrix object. * * @param transpose {boolean} Whether we need to transpose the matrix or not - * @param [out] {Array} If provided the array will be assigned to out + * @param [out=Float32Array[]} If provided the array will be assigned to out * @return {number[]} the newly created array which contains the matrix */ Matrix.prototype.toArray = function (transpose, out) @@ -14059,7 +14060,7 @@ /** * @class * @memberof PIXI - * @param points {PIXI.Point[]|number[]|...PIXI.Point|...number} This can be an array of Points that form the polygon, + * @param points_ {PIXI.Point[]|number[]|...PIXI.Point|...number} This can be an array of Points that form the polygon, * a flat array of numbers that will be interpreted as [x,y, x,y, ...], or the arguments passed can be * all the points of the polygon e.g. `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the * arguments passed can be flat x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are @@ -14818,7 +14819,7 @@ // constructor CanvasRenderer.prototype = Object.create(SystemRenderer.prototype); -CanvasRenderer.prototype.constructor = CanvasRenderer; +CanvasRenderer.prototype.constructor = CanvasRenderer; module.exports = CanvasRenderer; utils.pluginTarget.mixin(CanvasRenderer); @@ -14826,7 +14827,11 @@ /** * Renders the object to this canvas view * - * @param object {PIXI.DisplayObject} the object to be rendered + * @param displayObject {PIXI.DisplayObject} The object to be rendered + * @param [renderTexture] {PIXI.RenderTexture} A render texture to be rendered to. If unset, it will render to the root context. + * @param [clear=false] {boolean} Whether to clear the canvas before drawing + * @param [transform] {PIXI.Transform} A transformation to be applied + * @param [skipUpdateTransform=false] {boolean} Whether to skip the update transform */ CanvasRenderer.prototype.render = function (displayObject, renderTexture, clear, transform, skipUpdateTransform) { @@ -14912,9 +14917,9 @@ context.fillStyle = this._backgroundColorString; context.fillRect(0, 0, this.width, this.height); } - } else { + } //else { //TODO: implement background for CanvasRenderTarget or RenderTexture? - } + //} } // TODO RENDER TARGET STUFF HERE.. @@ -14998,7 +15003,6 @@ * This method adds it to the current stack of masks. * * @param maskData {object} the maskData that will be pushed - * @param renderer {PIXI.WebGLRenderer|PIXI.CanvasRenderer} The renderer context to use. */ CanvasMaskManager.prototype.pushMask = function (maskData) { @@ -15151,6 +15155,7 @@ * @memberof PIXI * @param width {number} the width for the newly created canvas * @param height {number} the height for the newly created canvas + * @param [resolution=CONST.RESOLUTION] The resolution of the canvas */ function CanvasRenderTarget(width, height, resolution) { @@ -15487,7 +15492,7 @@ /** * Track textures in the renderer so we can no longer listen to them on destruction. * - * @member {array} + * @member {*[]} * @private */ this._managedTextures = []; @@ -15597,6 +15602,7 @@ * Deletes the texture from WebGL * * @param texture {PIXI.BaseTexture|PIXI.Texture} the texture to destroy + * @param [_skipRemove=false] {boolean} Whether to skip removing the texture from the TextureManager. */ TextureManager.prototype.destroyTexture = function(texture, _skipRemove) { @@ -15748,7 +15754,7 @@ /** * Manages the stencil buffer. * - * @member {PIXI.StencilManager} + * @member {StencilManager} */ this.stencilManager = new StencilManager(this); @@ -15781,7 +15787,7 @@ /** * The currently active ObjectRenderer. * - * @member {PIXI.WebGLState} + * @member {WebGLState} */ this.state = new WebGLState(this.gl); @@ -15858,11 +15864,11 @@ /** * Renders the object to its webGL view * - * @param object {PIXI.DisplayObject} the object to be rendered - * @param renderTexture {PIXI.renderTexture} - * @param clear {Boolean} + * @param displayObject {PIXI.DisplayObject} the object to be rendered + * @param renderTexture {PIXI.RenderTexture} + * @param clear {boolean} * @param transform {PIXI.Transform} - * @param skipUpdateTransform {Boolean} + * @param skipUpdateTransform {boolean} */ WebGLRenderer.prototype.render = function (displayObject, renderTexture, clear, transform, skipUpdateTransform) { @@ -15978,7 +15984,7 @@ /** * Erases the active render target and fills the drawing area with a colour * - * @param clearColor {number} The colour + * @param [clearColor] {number} The colour */ WebGLRenderer.prototype.clear = function (clearColor) { @@ -16254,7 +16260,7 @@ /** * The stack holding all the different states * - * @member {array} + * @member {*[]} * @private */ this.stack = []; @@ -16499,10 +16505,8 @@ * @class * @memberof PIXI * @extends PIXI.Shader - * @param shaderManager {PIXI.ShaderManager} The webgl shader manager this shader works for. * @param [vertexSrc] {string} The source of the vertex shader. - * @param [fragmentSrc] {string} The source of the fragment shader. - * @param [customUniforms] {object} Custom uniforms to use to augment the built-in ones. + * @param [uniforms] {object} Custom uniforms to use to augment the built-in ones. * @param [fragmentSrc] {string} The source of the fragment shader. */ function Filter(vertexSrc, fragmentSrc, uniforms) @@ -16820,7 +16824,7 @@ ); sprite.renderable = false; - + this.maskSprite = sprite; this.maskMatrix = maskMatrix; } @@ -16832,14 +16836,14 @@ /** * Applies the filter * - * @param renderer {PIXI.WebGLRenderer} The renderer to retrieve the filter from + * @param filterManager {PIXI.FilterManager} The renderer to retrieve the filter from * @param input {PIXI.RenderTarget} * @param output {PIXI.RenderTarget} */ SpriteMaskFilter.prototype.apply = function (filterManager, input, output) { var maskSprite = this.maskSprite; - + this.uniforms.mask = maskSprite._texture; this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite ); this.uniforms.alpha = maskSprite.worldAlpha; @@ -17063,7 +17067,7 @@ else if(uniformData[i].type === 'mat3') { // check if its pixi matrix.. - if(uniforms[i].a) + if(uniforms[i].a !== undefined) { shader.uniforms[i] = uniforms[i].toArray(true); } @@ -17075,7 +17079,7 @@ else if(uniformData[i].type === 'vec2') { //check if its a point.. - if(uniforms[i].x) + if(uniforms[i].x !== undefined) { val = shader.uniforms[i]; val[0] = uniforms[i].x; @@ -17213,8 +17217,8 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param graphics {PIXI.Graphics} - * @param webGLData {any[]} + * @param target {PIXI.DisplayObject} + * @param maskData {*[]} */ MaskManager.prototype.pushMask = function (target, maskData) { @@ -17253,8 +17257,8 @@ /** * Removes the last mask from the mask stack and doesn't return it. * - * @param target {PIXI.RenderTarget} - * @param maskData {any[]} + * @param target {PIXI.DisplayObject} + * @param maskData {*[]} */ MaskManager.prototype.popMask = function (target, maskData) { @@ -17280,7 +17284,7 @@ * Applies the Mask and adds it to the current filter stack. * * @param target {PIXI.RenderTarget} - * @param maskData {any[]} + * @param maskData {PIXI.Sprite} */ MaskManager.prototype.pushSpriteMask = function (target, maskData) { @@ -17315,8 +17319,7 @@ /** * Applies the Mask and adds it to the current filter stack. * - * @param target {PIXI.RenderTarget} - * @param maskData {any[]} + * @param maskData {*[]} */ MaskManager.prototype.pushStencilMask = function (maskData) { @@ -17327,8 +17330,6 @@ /** * Removes the last filter from the filter stack and doesn't return it. * - * @param target {PIXI.RenderTarget} - * @param maskData {any[]} */ MaskManager.prototype.popStencilMask = function () { @@ -17385,7 +17386,7 @@ /** * Changes the mask stack that is used by this manager. * - * @param stencilMaskStack {PIXI.StencilMaskStack} The mask stack + * @param stencilMaskStack {PIXI.Graphics[]} The mask stack */ StencilMaskManager.prototype.setMaskStack = function ( stencilMaskStack ) { @@ -17407,7 +17408,6 @@ * Applies the Mask and adds it to the current filter stack. @alvin * * @param graphics {PIXI.Graphics} - * @param webGLData {any[]} */ StencilMaskManager.prototype.pushStencil = function (graphics) { @@ -17439,8 +17439,6 @@ /** * TODO @alvin - * @param graphics {PIXI.Graphics} - * @param webGLData {any[]} */ StencilMaskManager.prototype.popStencil = function () { @@ -17589,6 +17587,7 @@ * @class * @memberof PIXI * @param gl {WebGLRenderingContext} The gl context for this quad to use. + * @param state {object} TODO: Description */ function Quad(gl, state) { @@ -17670,8 +17669,8 @@ /** * Maps two Rectangle to the quad - * @param rect {PIXI.Rectangle} the first rectangle - * @param rect2 {PIXI.Rectangle} the second rectangle + * @param targetTextureFrame {PIXI.Rectangle} the first rectangle + * @param destinationFrame {PIXI.Rectangle} the second rectangle */ Quad.prototype.map = function(targetTextureFrame, destinationFrame) { @@ -17764,11 +17763,11 @@ * @class * @memberof PIXI * @param gl {WebGLRenderingContext} the current WebGL drawing context - * @param width {number} the horizontal range of the filter - * @param height {number} the vertical range of the filter - * @param scaleMode {number} See {@link PIXI.SCALE_MODES} for possible values - * @param resolution {number} the current resolution - * @param root {boolean} Whether this object is the root element or not + * @param [width=0] {number} the horizontal range of the filter + * @param [height=0] {number} the vertical range of the filter + * @param [scaleMode=CONST.SCALE_MODES.DEFAULT] {number} See {@link PIXI.SCALE_MODES} for possible values + * @param [resolution=CONST.RESOLUTION] {number} the current resolution + * @param [root=false] {boolean} Whether this object is the root element or not */ var RenderTarget = function(gl, width, height, scaleMode, resolution, root) { @@ -17786,7 +17785,7 @@ /** * A frame buffer * - * @member {WebGLFrameBuffer} + * @member {glCore.GLFramebuffer} */ this.frameBuffer = null; @@ -17800,7 +17799,7 @@ /** * The background colour of this render target, as an array of [r,g,b,a] values * - * @member {array} + * @member {number[]} */ this.clearColor = [0, 0, 0, 0]; @@ -17842,7 +17841,7 @@ /** * The stencil buffer stores masking data for the render target * - * @member {WebGLRenderBuffer} + * @member {glCore.GLBuffer} */ this.defaultFrame = new math.Rectangle(); this.destinationFrame = null; @@ -17851,14 +17850,14 @@ /** * The stencil buffer stores masking data for the render target * - * @member {WebGLRenderBuffer} + * @member {glCore.GLBuffer} */ this.stencilBuffer = null; /** * The data structure for the stencil masks * - * @member {PIXI.StencilMaskStack} + * @member {PIXI.Graphics[]} */ this.stencilMaskStack = []; @@ -17933,7 +17932,7 @@ /** * Clears the filter texture. * - * @param [bind=false] {boolean} Should we bind our framebuffer before clearing? + * @param [clearColor=this.clearColor] {number[]} Array of [r,g,b,a] to clear the framebuffer */ RenderTarget.prototype.clear = function(clearColor) { @@ -18670,8 +18669,6 @@ * * @static * @param frameId {string} The frame Id of the texture in the cache - * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter - * @param [scaleMode=PIXI.SCALE_MODES.DEFAULT] {number} if you want to specify the scale mode, see {@link PIXI.SCALE_MODES} for possible values * @return {PIXI.Sprite} A new Sprite using a texture from the texture cache matching the frameId */ Sprite.fromFrame = function (frameId) @@ -18692,6 +18689,8 @@ * * @static * @param imageId {string} The image url of the texture + * @param [crossorigin=(auto)] {boolean} if you want to specify the cross-origin parameter + * @param [scaleMode=PIXI.SCALE_MODES.DEFAULT] {number} if you want to specify the scale mode, see {@link PIXI.SCALE_MODES} for possible values * @return {PIXI.Sprite} A new Sprite using a texture from the texture cache matching the image id */ Sprite.fromImage = function (imageId, crossorigin, scaleMode) @@ -19074,21 +19073,21 @@ /** * Number of steps which will be used as a cap when rounding colors. * - * @member + * @member CanvasTinter */ CanvasTinter.cacheStepsPerColorChannel = 8; /** * Tint cache boolean flag. * - * @member + * @member CanvasTinter */ CanvasTinter.convertTintToImage = false; /** * Whether or not the Canvas BlendModes are supported, consequently the ability to tint using the multiply method. * - * @member + * @member CanvasTinter */ CanvasTinter.canUseMultiply = canUseNewCanvasBlendModes(); @@ -19231,7 +19230,6 @@ * Sets up the renderer context and necessary buffers. * * @private - * @param gl {WebGLRenderingContext} the current WebGL drawing context */ SpriteRenderer.prototype.onContextChange = function () { @@ -19992,7 +19990,7 @@ while (index < text.length) { current = characters[index++]; - if (isStroke) + if (isStroke) { this.context.strokeText(current, currentPosition, y); } @@ -20194,21 +20192,21 @@ for (var j = 0; j < words.length; j++) { var wordWidth = this.context.measureText(words[j]).width; - if (this._style.breakWords && wordWidth > wordWrapWidth) + if (this._style.breakWords && wordWidth > wordWrapWidth) { // Word should be split in the middle var characters = words[j].split(''); - for (var c = 0; c < characters.length; c++) + for (var c = 0; c < characters.length; c++) { var characterWidth = this.context.measureText(characters[c]).width; - if (characterWidth > spaceLeft) + if (characterWidth > spaceLeft) { result += '\n' + characters[c]; spaceLeft = wordWrapWidth - characterWidth; - } - else + } + else { - if (c === 0) + if (c === 0) { result += ' '; } @@ -20217,7 +20215,7 @@ } } } - else + else { var wordWidthWithSpace = wordWidth + this.context.measureText(' ').width; if (j === 0 || wordWidthWithSpace > spaceLeft) @@ -20705,7 +20703,6 @@ * * @param width {number} The width to resize to. * @param height {number} The height to resize to. - * @param updateBase {boolean} Should the baseTexture.width and height values be resized as well? */ BaseRenderTexture.prototype.resize = function (width, height) { @@ -20737,7 +20734,6 @@ /** * Destroys this texture * - * @param destroyBase {boolean} Whether to destroy the base texture as well */ BaseRenderTexture.prototype.destroy = function () { @@ -20765,9 +20761,9 @@ * * @class * @memberof PIXI - * @param source {Image|Canvas} the source object of the texture. + * @param [source ]{Image|HTMLCanvasElement} the source object of the texture. * @param [scaleMode=PIXI.SCALE_MODES.DEFAULT] {number} See {@link PIXI.SCALE_MODES} for possible values - * @param resolution {number} the resolution of the texture for devices with different pixel ratios + * @param [resolution=CONST.resolution] {number} the resolution of the texture for devices with different pixel ratios */ function BaseTexture(source, scaleMode, resolution) { @@ -20782,7 +20778,7 @@ * * @member {number} */ - this.resolution = resolution || 1; + this.resolution = resolution || CONST.RESOLUTION; /** * The width of the base texture set when the image has loaded @@ -20853,7 +20849,7 @@ * * TODO: Make this a setter that calls loadSource(); * - * @member {Image|Canvas} + * @member {Image|HTMLCanvasElement} * @readonly */ this.source = null; // set in loadSource, if at all @@ -20976,7 +20972,7 @@ * } * * @protected - * @param source {Image|Canvas} the source object of the texture. + * @param source {Image|HTMLCanvasElement} the source object of the texture. */ BaseTexture.prototype.loadSource = function (source) { @@ -21180,7 +21176,7 @@ * Helper function that creates a base texture from the given canvas element. * * @static - * @param canvas {Canvas} The canvas element source of the texture + * @param canvas {HTMLCanvasElement} The canvas element source of the texture * @param scaleMode {number} See {@link PIXI.SCALE_MODES} for possible values * @return PIXI.BaseTexture */ @@ -21243,6 +21239,7 @@ * @extends PIXI.Texture * @memberof PIXI * @param baseRenderTexture {PIXI.BaseRenderTexture} The renderer used for this RenderTexture + * @param [frame] {PIXI.Rectangle} The rectangle frame of the texture to show */ function RenderTexture(baseRenderTexture, frame) { @@ -21292,7 +21289,7 @@ * * @param width {number} The width to resize to. * @param height {number} The height to resize to. - * @param updateBase {boolean} Should the baseTexture.width and height values be resized as well? + * @param doNotResizeBaseTexture {boolean} Should the baseTexture.width and height values be resized as well? */ RenderTexture.prototype.resize = function (width, height, doNotResizeBaseTexture) { @@ -21635,7 +21632,7 @@ /** * Updates the internal WebGL UV cache. * - * @private + * @protected */ Texture.prototype._updateUvs = function () { @@ -21653,8 +21650,8 @@ * * @static * @param imageUrl {string} The image url of the texture - * @param crossorigin {boolean} Whether requests should be treated as crossorigin - * @param scaleMode {number} See {@link PIXI.SCALE_MODES} for possible values + * @param [crossorigin] {boolean} Whether requests should be treated as crossorigin + * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values * @return {PIXI.Texture} The newly created texture */ Texture.fromImage = function (imageUrl, crossorigin, scaleMode) @@ -21694,8 +21691,8 @@ * Helper function that creates a new Texture based on the given canvas element. * * @static - * @param canvas {Canvas} The canvas element source of the texture - * @param scaleMode {number} See {@link PIXI.SCALE_MODES} for possible values + * @param canvas {HTMLCanvasElement} The canvas element source of the texture + * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values * @return {PIXI.Texture} */ Texture.fromCanvas = function (canvas, scaleMode) @@ -21707,8 +21704,8 @@ * Helper function that creates a new Texture based on the given video element. * * @static - * @param video {HTMLVideoElement} - * @param scaleMode {number} See {@link PIXI.SCALE_MODES} for possible values + * @param video {HTMLVideoElement|string} The URL or actual element of the video + * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values * @return {PIXI.Texture} A Texture */ Texture.fromVideo = function (video, scaleMode) @@ -21728,7 +21725,7 @@ * * @static * @param videoUrl {string} - * @param scaleMode {number} See {@link PIXI.SCALE_MODES} for possible values + * @param [scaleMode] {number} See {@link PIXI.SCALE_MODES} for possible values * @return {PIXI.Texture} A Texture */ Texture.fromVideoUrl = function (videoUrl, scaleMode) @@ -21818,7 +21815,7 @@ * @constant */ Texture.EMPTY = new Texture(new BaseTexture()); -Texture.EMPTY.destroy = function() {} +Texture.EMPTY.destroy = function() {}; Texture.EMPTY.on = function() {}; Texture.EMPTY.once = function() {}; Texture.EMPTY.emit = function() {}; @@ -22290,7 +22287,6 @@ * {@link PIXI.ticker.Ticker#speed}, which is specific * to scaling {@link PIXI.ticker.Ticker#deltaTime}. * - * @member * @memberof PIXI.ticker.Ticker# * @readonly */ @@ -22309,7 +22305,6 @@ * When setting this property it is clamped to a value between * `0` and `PIXI.TARGET_FPMS * 1000`. * - * @member * @memberof PIXI.ticker.Ticker# * @default 10 */ @@ -22599,7 +22594,7 @@ * Nipped from the resource loader! * @private * @param url {string} The url to test. - * @param [location=window.location] {object} The location object to test against. + * @param loc [location=window.location] {object} The location object to test against. * @return {string} The crossOrigin value to use (or empty string for none). */ var determineCrossOrigin = function (url, loc) { @@ -22632,6 +22627,7 @@ }; module.exports = determineCrossOrigin; + },{"url":24}],109:[function(require,module,exports){ var CONST = require('../const'); @@ -22807,7 +22803,7 @@ /** * removeItems * - * @param {array} arr The target array + * @param {*[]} arr The target array * @param {number} startIdx The index to begin removing from (inclusive) * @param {number} removeCount How many items to remove */ @@ -22925,7 +22921,7 @@ /** * Mixes in the properties of the pluginTarget into another object * - * @param object {object} The obj to mix into + * @param obj {object} The obj to mix into */ mixin: function mixin(obj) { @@ -23492,7 +23488,7 @@ /** * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included). - * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @param renderTexture {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer * @return {Uint8ClampedArray} */ WebGLExtract.prototype.pixels = function ( renderTexture ) @@ -23667,7 +23663,7 @@ /** * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included). - * @param target {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer + * @param renderTexture {PIXI.DisplayObject|PIXI.RenderTexture} A displayObject or renderTexture to convert. If left empty will use use the main renderer * @return {Uint8ClampedArray} */ Extract.prototype.pixels = function ( renderTexture ) @@ -23888,7 +23884,7 @@ /** * The font descriptor of the BitmapText object * - * @member {Font} + * @member {string|object} * @memberof PIXI.extras.BitmapText# */ font: { @@ -24113,7 +24109,6 @@ },{"../core":57}],117:[function(require,module,exports){ var core = require('../core'); - /** * A MovieClip is a simple way to display an animation depicted by a list of textures. * @@ -24130,12 +24125,15 @@ * var mc = new PIXI.MovieClip(textureArray); * ``` * + * @typedef FrameObject + * @type {object} + * @property texture {PIXI.Texture} The {@link PIXI.Texture} of the frame + * @property time {number} the duration of the frame in ms + * * @class * @extends PIXI.Sprite * @memberof PIXI.extras - * @param textures {PIXI.Texture[]|Object[]} an array of {@link PIXI.Texture} or frame objects that make up the animation - * @param textures[].texture {PIXI.Texture} the {@link PIXI.Texture} of the frame - * @param textures[].time {number} the duration of the frame in ms + * @param textures {PIXI.Texture[]|FrameObject[]} an array of {@link PIXI.Texture} or frame objects that make up the animation */ function MovieClip(textures) { @@ -24431,6 +24429,7 @@ return new MovieClip(textures); }; + },{"../core":57}],118:[function(require,module,exports){ var core = require('../core'), tempPoint = new core.Point(), @@ -24443,7 +24442,7 @@ * @class * @extends PIXI.Sprite * @memberof PIXI.extras - * @param texture {Texture} the texture of the tiling sprite + * @param texture {PIXI.Texture} the texture of the tiling sprite * @param width {number} the width of the tiling sprite * @param height {number} the height of the tiling sprite */ @@ -24998,7 +24997,7 @@ // this renderTexture will be used to store the cached DisplayObject - var renderTexture = new core.RenderTexture.create(bounds.width | 0, bounds.height | 0); + var renderTexture = core.RenderTexture.create(bounds.width | 0, bounds.height | 0); // need to set // var m = _tempMatrix; @@ -25227,7 +25226,7 @@ * @class * @extends PIXI.Shader * @memberof PIXI.mesh - * @param shaderManager {PIXI.ShaderManager} The WebGL shader manager this shader works for. + * @param gl {PIXI.Shader} The WebGL shader manager this shader works for. */ function TilingShader(gl) { @@ -25954,8 +25953,8 @@ * Set the saturation matrix, increase the separation between colors * Increase saturation : increase contrast, brightness, and sharpness * - * @param amount {number} - * @param multiply {boolean} refer to ._loadMatrix() method + * @param [amount=0] {number} + * @param [multiply] {boolean} refer to ._loadMatrix() method */ ColorMatrixFilter.prototype.saturate = function (amount, multiply) { @@ -25977,9 +25976,8 @@ * * Call the saturate function * - * @param multiply {boolean} refer to ._loadMatrix() method */ -ColorMatrixFilter.prototype.desaturate = function (multiply) // jshint unused:false +ColorMatrixFilter.prototype.desaturate = function () // jshint unused:false { this.saturate(-1); }; @@ -26264,7 +26262,8 @@ * @class * @extends PIXI.Filter * @memberof PIXI.filters - * @param sprite {PIXI.Sprite} the sprite used for the displacement map. (make sure its added to the scene!) + * @param sprite {PIXI.Sprite} The sprite used for the displacement map. (make sure its added to the scene!) + * @param scale {number} The scale of the displacement */ function DisplacementFilter(sprite, scale) { @@ -27057,10 +27056,11 @@ * This function is provides a neat way of crawling through the scene graph and running a specified function on all interactive objects it finds. * It will also take care of hit testing the interactive objects and passes the hit across in the function. * - * @param {PIXI.Point} point the point that is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject the displayObject that will be hit test (recurcsivly crawls its children) - * @param {Function} func the function that will be called on each interactive object. The displayObject and hit will be passed to the function - * @param {boolean} hitTest this indicates if the objects inside should be hit test against the point + * @param point {PIXI.Point} the point that is tested for collision + * @param displayObject {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} the displayObject that will be hit test (recurcsivly crawls its children) + * @param [func] {Function} the function that will be called on each interactive object. The displayObject and hit will be passed to the function + * @param [hitTest] {boolean} this indicates if the objects inside should be hit test against the point + * @param [interactive] {boolean} Whether the displayObject is interactive * @return {boolean} returns true if the displayObject hit the point */ InteractionManager.prototype.processInteractive = function (point, displayObject, func, hitTest, interactive) @@ -27162,6 +27162,7 @@ { displayObject.worldTransform.applyInverse(point, this._tempPoint); hit = displayObject.hitArea.contains( this._tempPoint.x, this._tempPoint.y ); + } else if(displayObject.containsPoint) { @@ -27548,7 +27549,7 @@ /** * Grabs an interaction data object from the internal pool * - * @param touchEvent {EventData} The touch event we need to pair with an interactionData object + * @param touchEvent {object} The touch event we need to pair with an interactionData object * * @private */ @@ -27908,7 +27909,7 @@ * ``` * * @class - * @extends PIXI.ResourceLoader + * @extends module:resource-loader.ResourceLoader * @memberof PIXI.loaders * @param [baseUrl=''] {string} The base url for all resources loaded by this loader. * @param [concurrency=10] {number} The number of resources to load concurrently. @@ -28497,7 +28498,6 @@ /** * When the texture is updated, this event will fire to update the scale and frame * - * @param event * @private */ Mesh.prototype._onTextureUpdate = function () @@ -28508,7 +28508,7 @@ /** * Returns the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. * - * @param matrix {PIXI.Matrix} the transformation matrix of the sprite + * @param [matrix=this.worldTransform] {PIXI.Matrix} the transformation matrix of the sprite * @return {PIXI.Rectangle} the framing rectangle */ Mesh.prototype.getBounds = function (matrix) @@ -28989,7 +28989,7 @@ * @class * @extends PIXI.Shader * @memberof PIXI.mesh - * @param shaderManager {PIXI.ShaderManager} The WebGL shader manager this shader works for. + * @param gl {Shader} TODO: Find a good explanation for this. */ function MeshShader(gl) { @@ -29350,7 +29350,6 @@ /** * Destroys the container * - * @param [destroyChildren=false] {boolean} if set to true, all the children will have their destroy method called as well */ ParticleContainer.prototype.destroy = function () { core.Container.prototype.destroy.apply(this, arguments); @@ -30039,9 +30038,9 @@ /** * @class - * @extends PIXI.TextureShader + * @extends PIXI.Shader * @memberof PIXI - * @param shaderManager {ShaderManager} The webgl shader manager this shader works for. + * @param gl {PIXI.Shader} The webgl shader manager this shader works for. */ function ParticleShader(gl) { diff --git a/bin/pixi.js.map b/bin/pixi.js.map index 24d39c6..d916c18 100644 --- a/bin/pixi.js.map +++ b/bin/pixi.js.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["pixi.js"],"sourcesContent":["(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.PIXI = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o= data.byteLength)\n\t{\n\t\tgl.bufferSubData(this.type, offset, data);\n\t}\n\telse\n\t{\n\t\tgl.bufferData(this.type, data, this.drawType);\n\t}\n\n\tthis.data = data;\n}\n/**\n * Binds the buffer\n *\n */\nBuffer.prototype.bind = function()\n{\n\tvar gl = this.gl;\n\tgl.bindBuffer(this.type, this.buffer);\n}\n\nBuffer.createVertexBuffer = function(gl, data, drawType)\n{\n\treturn new Buffer(gl, gl.ARRAY_BUFFER, data, drawType);\n}\n\nBuffer.createIndexBuffer = function(gl, data, drawType)\n{\n\treturn new Buffer(gl, gl.ELEMENT_ARRAY_BUFFER, data, drawType);\n}\n\nBuffer.create = function(gl, type, data, drawType)\n{\n\treturn new Buffer(gl, type, drawType);\n}\n\n/**\n * Destroys the buffer\n *\n */\nBuffer.prototype.destroy = function(){\n\tthis.gl.deleteBuffer(this.buffer);\n}\n\nmodule.exports = Buffer;\n\n},{}],3:[function(require,module,exports){\n\nvar Texture = require('./GLTexture');\n\n/**\n * Helper class to create a webGL Framebuffer\n *\n * @class\n * @memberof pixi.gl\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param width {Number} the width of the drawing area of the frame buffer\n * @param height {Number} the height of the drawing area of the frame buffer\n */\nvar Framebuffer = function(gl, width, height)\n{\n\t/**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n\tthis.gl = gl;\n\n\t/**\n * The frame buffer\n *\n * @member {WebGLFramebuffer}\n */\n\tthis.framebuffer = gl.createFramebuffer();\n\n\t/**\n * The stencil buffer\n *\n * @member {WebGLRenderbuffer}\n */\n\tthis.stencil = null;\n\n\t/**\n * The stencil buffer\n *\n * @member {GLTexture}\n */\n\tthis.texture = null;\n\n\t/**\n * The width of the drawing area of the buffer\n *\n * @member {Number}\n */\n\tthis.width = width || 100;\n\t/**\n * The height of the drawing area of the buffer\n *\n * @member {Number}\n */\n\tthis.height = height || 100;\n}\n\n/**\n * Adds a texture to the frame buffer\n * @param texture {GLTexture}\n */\nFramebuffer.prototype.enableTexture = function(texture)\n{\n\tvar gl = this.gl;\n\n\tthis.texture = texture || new Texture(gl);\n\n\tthis.texture.bind();\n\n\t//gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n\n\tthis.bind();\n\n\tgl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.texture.texture, 0);\n}\n\n/**\n * Initialises the stencil buffer\n * @mat maybe you can come up with a better explaination\n */\nFramebuffer.prototype.enableStencil = function()\n{\n\tif(this.stencil)return;\n\n\tvar gl = this.gl;\n\n\tthis.stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.stencil);\n\n // TODO.. this is depth AND stencil?\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, this.width , this.height );\n}\n\n/**\n * Erases the drawing area and fills it with a colour\n * @param r {Number} the red value of the clearing colour\n * @param g {Number} the green value of the clearing colour\n * @param b {Number} the blue value of the clearing colour\n * @param a {Number} the alpha value of the clearing colour\n */\nFramebuffer.prototype.clear = function( r, g, b, a )\n{\n\tthis.bind();\n\n\tvar gl = this.gl;\n\n gl.clearColor(r, g, b, a);\n gl.clear(gl.COLOR_BUFFER_BIT);\n}\n\n/**\n * Binds the frame buffer to the WebGL context\n */\nFramebuffer.prototype.bind = function()\n{\n\tvar gl = this.gl;\n\n\tif(this.texture)\n\t{\n\t\tthis.texture.unbind();\n\t}\n\n\tgl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer );\n}\n\n/**\n * Unbinds the frame buffer to the WebGL context\n */\nFramebuffer.prototype.unbind = function()\n{\n\tvar gl = this.gl;\n\tgl.bindFramebuffer(gl.FRAMEBUFFER, null );\t\n}\n/**\n * Resizes the drawing area of the buffer to the given width and height\n * @param width {Number} the new width\n * @param height {Number} the new height\n */\nFramebuffer.prototype.resize = function(width, height)\n{\n\tvar gl = this.gl;\n\n\tthis.width = width;\n\tthis.height = height;\n\n\tif ( this.texture )\n {\n \tthis.texture.uploadData(null, width, height);\n\t}\n\n\tif ( this.stencil )\n {\n // update the stencil buffer width and height\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height);\n }\n}\n\n/**\n * Destroys this buffer\n */\nFramebuffer.prototype.destroy = function()\n{\n\tvar gl = this.gl;\n\n\t//TODO\n\tif(this.texture)\n\t{\n\t\tthis.texture.destroy();\n\t}\n\n\tgl.deleteFramebuffer(this.framebuffer);\n\n\tthis.gl = null;\n\n\tthis.stencil = null;\n\tthis.texture = null;\n}\n\n/**\n * Creates a frame buffer with a texture containing the given data\n * @mat can you confirm ? :)\n * @static\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param width {Number} the width of the drawing area of the frame buffer\n * @param height {Number} the height of the drawing area of the frame buffer\n * @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data\n */\nFramebuffer.createRGBA = function(gl, width, height, data)\n{\n\tvar texture = Texture.fromData(gl, null, width, height);\n\ttexture.enableNearestScaling();\n texture.enableWrapClamp();\n\n //now create the framebuffer object and attach the texture to it.\n var fbo = new Framebuffer(gl, width, height);\n fbo.enableTexture(texture);\n\n fbo.unbind();\n\n return fbo;\n}\n\n/**\n * Creates a frame buffer with a texture containing the given data\n * @mat not sure what the difference is with the method above ?\n * @static\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param width {Number} the width of the drawing area of the frame buffer\n * @param height {Number} the height of the drawing area of the frame buffer\n * @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data\n */\nFramebuffer.createFloat32 = function(gl, width, height, data)\n{\n\t// create a new texture..\n var texture = new Texture.fromData(gl, data, width, height);\n texture.enableNearestScaling();\n texture.enableWrapClamp();\n\n //now create the framebuffer object and attach the texture to it.\n var fbo = new Framebuffer(gl, width, height);\n fbo.enableTexture(texture)\n\n fbo.unbind();\n\n return fbo;\n}\n\nmodule.exports = Framebuffer;\n\n},{\"./GLTexture\":5}],4:[function(require,module,exports){\n\nvar compileProgram = require('./shader/compileProgram'),\n\textractAttributes = require('./shader/extractAttributes'),\n\textractUniforms = require('./shader/extractUniforms'),\n\tgenerateUniformAccessObject = require('./shader/generateUniformAccessObject');\n\n/**\n * Helper class to create a webGL Shader\n *\n * @class\n * @memberof pixi.gl\n * @param gl {WebGLRenderingContext}\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings.\n */\nvar Shader = function(gl, vertexSrc, fragmentSrc)\n{\n\t/**\n\t * The current WebGL rendering context\n\t *\n\t * @member {WebGLRenderingContext}\n\t */\n\tthis.gl = gl;\n\n\t/**\n\t * The shader program\n\t *\n\t * @member {WebGLProgram}\n\t */\n\t// First compile the program..\n\tthis.program = compileProgram(gl, vertexSrc, fragmentSrc);\n\n\t/**\n\t * The attributes of the shader as an object containing the following properties\n\t * {\n\t * \ttype,\n\t * \tsize,\n\t * \tlocation,\n\t * \tpointer\n\t * }\n\t * @member {Object}\n\t */\n\t// next extract the attributes\n\tthis.attributes = extractAttributes(gl, this.program);\n\n var uniformData = extractUniforms(gl, this.program);\n\n\t/**\n\t * The uniforms of the shader as an object containing the following properties\n\t * {\n\t * \tgl,\n\t * \tdata\n\t * }\n\t * @member {Object}\n\t */\n this.uniforms = generateUniformAccessObject( gl, uniformData );\n}\n/**\n * Uses this shader\n */\nShader.prototype.bind = function()\n{\n\tthis.gl.useProgram(this.program);\n}\n\n/**\n * Destroys this shader\n * TODO\n */\nShader.prototype.destroy = function()\n{\n\tvar gl = this.gl;\n}\n\nmodule.exports = Shader;\n\n},{\"./shader/compileProgram\":9,\"./shader/extractAttributes\":11,\"./shader/extractUniforms\":12,\"./shader/generateUniformAccessObject\":13}],5:[function(require,module,exports){\n\n/**\n * Helper class to create a WebGL Texture\n *\n * @class\n * @memberof pixi.gl\n * @param gl {WebGLRenderingContext} The current WebGL context\n * @param width {number} the width of the texture\n * @param height {number} the height of the texture\n * @param format {number} the pixel format of the texture. defaults to gl.RGBA\n * @param type {number} the gl type of the texture. defaults to gl.UNSIGNED_BYTE\n */\nvar Texture = function(gl, width, height, format, type)\n{\n\t/**\n\t * The current WebGL rendering context\n\t *\n\t * @member {WebGLRenderingContext}\n\t */\n\tthis.gl = gl;\n\n\n\t/**\n\t * The WebGL texture\n\t *\n\t * @member {WebGLTexture}\n\t */\n\tthis.texture = gl.createTexture();\n\n\t/**\n\t * If mipmapping was used for this texture, enable and disable with enableMipmap()\n\t *\n\t * @member {Boolean}\n\t */\n\t// some settings..\n\tthis.mipmap = false;\n\n\n\t/**\n\t * Set to true to enable pre-multiplied alpha\n\t *\n\t * @member {Boolean}\n\t */\n\tthis.premultiplyAlpha = false;\n\n\t/**\n\t * The width of texture\n\t *\n\t * @member {Number}\n\t */\n\tthis.width = width || 0;\n\t/**\n\t * The height of texture\n\t *\n\t * @member {Number}\n\t */\n\tthis.height = height || 0;\n\n\t/**\n\t * The pixel format of the texture. defaults to gl.RGBA\n\t *\n\t * @member {Number}\n\t */\n\tthis.format = format || gl.RGBA;\n\n\t/**\n\t * The gl type of the texture. defaults to gl.UNSIGNED_BYTE\n\t *\n\t * @member {Number}\n\t */\n\tthis.type = type || gl.UNSIGNED_BYTE;\n\n\n}\n\n/**\n * Uploads this texture to the GPU\n * @param source {HTMLImageElement|ImageData|HTMLVideoElement} the source image of the texture\n */\nTexture.prototype.upload = function(source)\n{\n\tthis.bind();\n\n\tvar gl = this.gl;\n\n\t// if the source is a video, we need to use the videoWidth / videoHeight properties as width / height will be incorrect.\n\tthis.width = source.videoWidth || source.width;\n\tthis.height = source.videoHeight || source.height;\n\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);\n gl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.format, this.type, source);\n}\n\nvar FLOATING_POINT_AVAILABLE = false;\n\n/**\n * Use a data source and uploads this texture to the GPU\n * @param data {TypedArray} the data to upload to the texture\n * @param width {number} the new width of the texture\n * @param height {number} the new height of the texture\n */\nTexture.prototype.uploadData = function(data, width, height)\n{\n\tthis.bind();\n\n\tvar gl = this.gl;\n\n\tthis.width = width || this.width;\n\tthis.height = height || this.height;\n\n\tif(data instanceof Float32Array)\n\t{\n\t\tif(!FLOATING_POINT_AVAILABLE)\n\t\t{\n\t\t\tvar ext = gl.getExtension(\"OES_texture_float\");\n\n\t\t\tif(ext)\n\t\t\t{\n\t\t\t\tFLOATING_POINT_AVAILABLE = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow new Error('floating point textures not available');\n\t\t\t}\n\t\t}\n\n\t\tthis.type = gl.FLOAT;\n\t}\n\telse\n\t{\n\t\t// TODO support for other types\n\t\tthis.type = gl.UNSIGNED_BYTE;\n\t}\n\n\n\n\t// what type of data?\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);\n\tgl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.width, this.height, 0, this.format, this.type, data || null);\n\n}\n\n/**\n * Binds the texture\n * @param location {@mat}\n */\nTexture.prototype.bind = function(location)\n{\n\tvar gl = this.gl;\n\n\tif(location !== undefined)\n\t{\n\t\tgl.activeTexture(gl.TEXTURE0 + location);\n\t}\n\n\tgl.bindTexture(gl.TEXTURE_2D, this.texture);\n}\n\n/**\n * Unbinds the texture\n */\nTexture.prototype.unbind = function()\n{\n\tvar gl = this.gl;\n\tgl.bindTexture(gl.TEXTURE_2D, null);\n}\n\n/**\n * @mat\n * @param linear {Boolean} if we want to use linear filtering or nearest neighbour interpolation\n */\nTexture.prototype.minFilter = function( linear )\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tif(this.mipmap)\n\t{\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, linear ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n\t}\n\telse\n\t{\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, linear ? gl.LINEAR : gl.NEAREST);\n\t}\n}\n\n/**\n * @mat\n * @param linear {Boolean} if we want to use linear filtering or nearest neighbour interpolation\n */\nTexture.prototype.magFilter = function( linear )\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, linear ? gl.LINEAR : gl.NEAREST);\n}\n\n/**\n * Enables mipmapping\n */\nTexture.prototype.enableMipmap = function()\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tthis.mipmap = true;\n\n\tgl.generateMipmap(gl.TEXTURE_2D);\n}\n\n/**\n * Enables linear filtering\n */\nTexture.prototype.enableLinearScaling = function()\n{\n\tthis.minFilter(true);\n\tthis.magFilter(true);\n}\n\n/**\n * Enables nearest neighbour interpolation\n */\nTexture.prototype.enableNearestScaling = function()\n{\n\tthis.minFilter(false);\n\tthis.magFilter(false);\n}\n\n/**\n * Enables clamping on the texture so WebGL will not repeat it\n */\nTexture.prototype.enableWrapClamp = function()\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n}\n\n/**\n * Enable tiling on the texture\n */\nTexture.prototype.enableWrapRepeat = function()\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);\n}\n\n/**\n * @mat\n */\nTexture.prototype.enableWrapMirrorRepeat = function()\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.MIRRORED_REPEAT);\n}\n\n\n/**\n * Destroys this texture\n */\nTexture.prototype.destroy = function()\n{\n\tvar gl = this.gl;\n\t//TODO\n\tgl.deleteTexture(this.texture);\n}\n\n/**\n * @static\n * @param gl {WebGLRenderingContext} The current WebGL context\n * @param source {HTMLImageElement|ImageData} the source image of the texture\n * @param premultiplyAlpha {Boolean} If we want to use pre-multiplied alpha\n */\nTexture.fromSource = function(gl, source, premultiplyAlpha)\n{\n\tvar texture = new Texture(gl);\n\ttexture.premultiplyAlpha = premultiplyAlpha || false;\n\ttexture.upload(source);\n\n\treturn texture;\n}\n\n/**\n * @static\n * @param gl {WebGLRenderingContext} The current WebGL context\n * @param data {TypedArray} the data to upload to the texture\n * @param width {number} the new width of the texture\n * @param height {number} the new height of the texture\n */\nTexture.fromData = function(gl, data, width, height)\n{\n\t//console.log(data, width, height);\n\tvar texture = new Texture(gl);\n\ttexture.uploadData(data, width, height);\n\n\treturn texture;\n}\n\n\nmodule.exports = Texture;\n\n},{}],6:[function(require,module,exports){\n\n// state object//\nvar setVertexAttribArrays = require( './setVertexAttribArrays' );\n\n/**\n * Helper class to work with WebGL VertexArrayObjects (vaos)\n * Only works if WebGL extensions are enabled (they usually are)\n *\n * @class\n * @memberof pixi.gl\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n */\nfunction VertexArrayObject(gl, state)\n{\n\n\tthis.nativeVaoExtension = (\n gl.getExtension('OES_vertex_array_object') ||\n gl.getExtension('MOZ_OES_vertex_array_object') ||\n gl.getExtension('WEBKIT_OES_vertex_array_object')\n );\n\n\tthis.nativeState = state;\n\n\tif(this.nativeVaoExtension)\n\t{\n\t\tthis.nativeVao = this.nativeVaoExtension.createVertexArrayOES();\n\t\t\n\t\tvar maxAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n\t\t\n\t\t// VAO - overwrite the state..\n\t\tthis.nativeState = {tempAttribState:new Array(maxAttribs)\n\t\t\t\t\t\t\t,attribState:new Array(maxAttribs)};\n\t}\n\n\t/**\n\t * The current WebGL rendering context\n\t *\n\t * @member {WebGLRenderingContext}\n\t */\n\tthis.gl = gl;\n\n\t/**\n\t * An array of attributes ? @mat\n\t *\n\t * @member {Array}\n\t */\n\tthis.attributes = [];\n\n\t/**\n\t * @mat\n\t *\n\t * @member {Array}\n\t */\n\tthis.indexBuffer = null;\n\n\t/**\n\t * A boolean flag\n\t *\n\t * @member {Boolean}\n\t */\n\tthis.dirty = false;\n}\n\nVertexArrayObject.prototype.constructor = VertexArrayObject;\nmodule.exports = VertexArrayObject;\n\n\n/**\n * Binds the buffer\n */\nVertexArrayObject.prototype.bind = function()\n{\n\tif(this.nativeVao)\n\t{\n\t\tthis.nativeVaoExtension.bindVertexArrayOES(this.nativeVao);\n\n\t\tif(this.dirty)\n\t\t{\n\t\t\tthis.dirty = false;\n\t\t\tthis.activate();\n\t\t}\n\t}\n\telse\n\t{\n\t\t\n\t\tthis.activate();\n\t}\n\n\treturn this;\n}\n\n/**\n * Unbinds the buffer\n */\nVertexArrayObject.prototype.unbind = function()\n{\n\tif(this.nativeVao)\n\t{\n\t\tthis.nativeVaoExtension.bindVertexArrayOES(null);\n\t}\n\n\treturn this;\n}\n\n/**\n * Uses this vao\n */\nVertexArrayObject.prototype.activate = function()\n{\n\t\n\tvar gl = this.gl;\n\tvar lastBuffer = null;\n\n\tfor (var i = 0; i < this.attributes.length; i++)\n\t{\n\t\tvar attrib = this.attributes[i];\n\n\t\tif(lastBuffer !== attrib.buffer)\n\t\t{\n\t\t\tattrib.buffer.bind();\n\t\t\tlastBuffer = attrib.buffer;\n\t\t}\n\n\t\t//attrib.attribute.pointer(attrib.type, attrib.normalized, attrib.stride, attrib.start);\n\t\tgl.vertexAttribPointer(attrib.attribute.location,\n\t\t\t\t\t\t\t attrib.attribute.size, attrib.type || gl.FLOAT,\n\t\t\t\t\t\t\t attrib.normalized || false,\n\t\t\t\t\t\t\t attrib.stride || 0,\n\t\t\t\t\t\t\t attrib.start || 0);\n\n\n\t};\n\n\tsetVertexAttribArrays(gl, this.attributes, this.nativeState);\n\t\n\tthis.indexBuffer.bind();\n\n\treturn this;\n}\n\n/**\n *\n * @param buffer {WebGLBuffer}\n * @param attribute {[type]}\n * @param type {[type]}\n * @param normalized {[type]}\n * @param stride {Number}\n * @param start {Number}\n */\nVertexArrayObject.prototype.addAttribute = function(buffer, attribute, type, normalized, stride, start)\n{\n this.attributes.push({\n \tbuffer: \tbuffer,\n \tattribute: \tattribute,\n\n \tlocation: \tattribute.location,\n\t \ttype: \t\ttype || this.gl.FLOAT,\n\t \tnormalized: normalized || false,\n\t \tstride: \tstride || 0,\n\t \tstart: \t\tstart || 0\n\t})\n\n\tthis.dirty = true;\n\n\treturn this;\n}\n\n/**\n *\n * @param buffer {WebGLBuffer}\n * @param options {Object}\n */\nVertexArrayObject.prototype.addIndex = function(buffer, options)\n{\n this.indexBuffer = buffer;\n\n this.dirty = true;\n\n return this;\n}\n\n/**\n * Unbinds this vao and disables it\n */\nVertexArrayObject.prototype.clear = function()\n{\n\tvar gl = this.gl;\n\n\t// TODO - should this function unbind after clear?\n\t// for now, no but lets see what happens in the real world!\n\tif(this.nativeVao)\n\t{\n\t\tthis.nativeVaoExtension.bindVertexArrayOES(this.nativeVao);\n\t}\n\n\tthis.attributes.length = 0;\n\tthis.indexBuffer = null;\n\n\treturn this;\n}\n\n/**\n * @mat\n * @param type {Number}\n * @param size {Number}\n * @param start {Number}\n */\nVertexArrayObject.prototype.draw = function(type, size, start)\n{\n\tvar gl = this.gl;\n\tgl.drawElements(type, size, gl.UNSIGNED_SHORT, start || 0);\n\n\treturn this;\n}\n\n},{\"./setVertexAttribArrays\":8}],7:[function(require,module,exports){\n\n/**\n * Helper class to create a webGL Context\n *\n * @class\n * @memberof pixi.gl\n * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from\n * @param options {Object} An options object that gets passed in to the canvas element containing the context attributes,\n * see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext for the options available\n * @return {WebGLRenderingContext} the WebGL context\n */\nvar createContext = function(canvas, options)\n{\n var gl = canvas.getContext('webgl', options) || \n \t canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support webGL. Try using the canvas renderer');\n }\n\n return gl;\n}\n\nmodule.exports = createContext;\n\n},{}],8:[function(require,module,exports){\nvar GL_MAP = {};\n\n/**\n * @mat\n * @param gl {WebGLRenderingContext} The current WebGL context\n * @param attribs {[type]}\n */\nvar setVertexAttribArrays = function (gl, attribs, state)\n{\n\n if(state)\n {\n\n var i,\n tempAttribState = state.tempAttribState,\n attribState = state.attribState;\n\n for (i = 0; i < tempAttribState.length; i++)\n {\n tempAttribState[i] = false;\n }\n\n // set the new attribs\n for (i in attribs)\n {\n tempAttribState[attribs[i].attribute.location] = true;\n }\n\n for (i = 0; i < attribState.length; i++)\n {\n if (attribState[i] !== tempAttribState[i])\n {\n attribState[i] = tempAttribState[i];\n\n if (state.attribState[i])\n {\n gl.enableVertexAttribArray(i);\n }\n else\n {\n gl.disableVertexAttribArray(i);\n }\n }\n }\n\n }\n else\n {\n for (var i = 0; i < attribs.length; i++)\n {\n var attrib = attribs[i];\n gl.enableVertexAttribArray(attrib.attribute.location);\n }\n }\n};\n\nmodule.exports = setVertexAttribArrays;\n\n},{}],9:[function(require,module,exports){\n\n/**\n *\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings.\n * @return {WebGLProgram} the shader program\n */\ncompileProgram = function(gl, vertexSrc, fragmentSrc)\n{\n var glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc);\n var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc);\n\n var program = gl.createProgram();\n\n gl.attachShader(program, glVertShader);\n gl.attachShader(program, glFragShader);\n gl.linkProgram(program);\n\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n console.error('Pixi.js Error: Could not initialize shader.');\n console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS));\n console.error('gl.getError()', gl.getError());\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n\n gl.deleteProgram(program);\n program = null;\n }\n\n // clean up some shaders\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n return program;\n}\n\n/**\n *\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @return {WebGLShader} the shader\n */\nvar compileShader = function (gl, type, src)\n{\n var shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n console.log(gl.getShaderInfoLog(shader));\n return null;\n }\n\n return shader;\n};\n\nmodule.exports = compileProgram;\n\n},{}],10:[function(require,module,exports){\n\n\nvar defaultValue = function(type, size) \n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2': \n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4': \n return new Float32Array(4 * size);\n \n case 'int':\n case 'sampler2D':\n return 0;\n\n case 'ivec2': \n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4': \n return new Int32Array(4 * size);\n\n case 'bool': \n return false;\n\n case 'bvec2':\n\n return booleanArray( 2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0\n ,0, 1]);\n\n case 'mat3': \n return new Float32Array([1, 0, 0\n ,0, 1, 0\n ,0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0\n ,0, 1, 0, 0\n ,0, 0, 1, 0\n ,0, 0, 0, 1]);\n }\n}\n\nvar booleanArray = function(size)\n{\n var array = new Array(size);\n\n for (var i = 0; i < array.length; i++) \n {\n array[i] = false;\n };\n\n return array;\n}\n\nmodule.exports = defaultValue;\n\n},{}],11:[function(require,module,exports){\n\nvar mapType = require('./mapType');\nvar mapSize = require('./mapSize');\n\n/**\n * Extracts the attributes\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param program {WebGLProgram} The shader program to get the attributes from\n * @return attributes {Object}\n */\nvar extractAttributes = function(gl, program)\n{\n var attributes = {};\n\n var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES)\n\n for (var i = 0; i < totalAttributes; i++)\n {\n var attribData = gl.getActiveAttrib(program, i);\n var type = mapType(gl, attribData.type);\n\n attributes[attribData.name] = {\n type:type,\n size:mapSize(type),\n location:gl.getAttribLocation(program, attribData.name),\n //TODO - make an attribute object\n pointer:function(type, normalized, stride, start){\n\n // console.log(this.location)\n gl.vertexAttribPointer(this.location,this.size, type || gl.FLOAT, normalized || false, stride || 0, start || 0);\n\n }\n }\n };\n\n return attributes;\n}\n\nmodule.exports = extractAttributes;\n\n},{\"./mapSize\":14,\"./mapType\":15}],12:[function(require,module,exports){\nvar mapType = require('./mapType');\nvar defaultValue = require('./defaultValue');\n\n/**\n * Extracts the uniforms\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param program {WebGLProgram} The shader program to get the uniforms from\n * @return uniforms {Object}\n */\nvar extractUniforms = function(gl, program)\n{\n\tvar uniforms = {};\n\n var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS)\n\n for (var i = 0; i < totalUniforms; i++)\n {\n \tvar uniformData = gl.getActiveUniform(program, i);\n \tvar name = uniformData.name.replace(/\\[.*?\\]/, \"\");\n var type = mapType(gl, uniformData.type );\n\n \tuniforms[name] = {\n \t\ttype:type,\n \t\tsize:uniformData.size,\n \t\tlocation:gl.getUniformLocation(program, name),\n \t\tvalue:defaultValue(type, uniformData.size)\n \t}\n };\n\n\treturn uniforms;\n}\n\nmodule.exports = extractUniforms;\n\n},{\"./defaultValue\":10,\"./mapType\":15}],13:[function(require,module,exports){\n/**\n * Extracts the attributes\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param uniforms {Array} @mat ?\n * @return attributes {Object}\n */\nvar generateUniformAccessObject = function(gl, uniformData)\n{\n // this is the object we will be sending back.\n // an object hierachy will be created for structs\n var uniforms = {data:{}};\n\n uniforms.gl = gl;\n\n var uniformKeys= Object.keys(uniformData);\n\n for (var i = 0; i < uniformKeys.length; i++)\n {\n var fullName = uniformKeys[i]\n\n var nameTokens = fullName.split('.');\n var name = nameTokens[nameTokens.length - 1];\n\n var uniformGroup = getUniformGroup(nameTokens, uniforms);\n\n var uniform = uniformData[fullName];\n uniformGroup.data[name] = uniform;\n\n uniformGroup.gl = gl;\n\n Object.defineProperty(uniformGroup, name, {\n get: generateGetter(name),\n set: generateSetter(name, uniform)\n })\n };\n\n return uniforms;\n}\n\nvar generateGetter = function(name)\n{\n\tvar template = getterTemplate.replace('%%', name);\n\treturn new Function(template);\n}\n\nvar generateSetter = function(name, uniform)\n{\n var template = setterTemplate.replace(/%%/g, name);\n var setTemplate\n\n if(uniform.size === 1)\n {\n setTemplate = GLSL_TO_SINGLE_SETTERS[uniform.type];\n }\n else\n {\n setTemplate = GLSL_TO_ARRAY_SETTERS[uniform.type];\n }\n\n if(setTemplate)\n {\n template += \"\\nthis.gl.\" + setTemplate + \";\";\n }\n\n \treturn new Function('value', template);\n}\n\nvar getUniformGroup = function(nameTokens, uniform)\n{\n var cur = uniform;\n\n for (var i = 0; i < nameTokens.length - 1; i++)\n {\n var o = cur[nameTokens[i]] || {data:{}};\n cur[nameTokens[i]] = o;\n cur = o;\n };\n\n return cur\n}\n\nvar getterTemplate = [\n 'return this.data.%%.value;',\n].join('\\n');\n\nvar setterTemplate = [\n 'this.data.%%.value = value;',\n 'var location = this.data.%%.location;'\n].join('\\n');\n\n\nvar GLSL_TO_SINGLE_SETTERS = {\n\n 'float': 'uniform1f(location, value)',\n\n 'vec2': 'uniform2f(location, value[0], value[1])',\n 'vec3': 'uniform3f(location, value[0], value[1], value[2])',\n 'vec4': 'uniform4f(location, value[0], value[1], value[2], value[3])',\n\n 'int': 'uniform1i(location, value)',\n 'ivec2': 'uniform2i(location, value[0], value[1])',\n 'ivec3': 'uniform3i(location, value[0], value[1], value[2])',\n 'ivec4': 'uniform4i(location, value[0], value[1], value[2], value[3])',\n\n 'bool': 'uniform1i(location, value)',\n 'bvec2': 'uniform2i(location, value[0], value[1])',\n 'bvec3': 'uniform3i(location, value[0], value[1], value[2])',\n 'bvec4': 'uniform4i(location, value[0], value[1], value[2], value[3])',\n\n 'mat2': 'uniformMatrix2fv(location, false, value)',\n 'mat3': 'uniformMatrix3fv(location, false, value)',\n 'mat4': 'uniformMatrix4fv(location, false, value)',\n\n 'sampler2D':'uniform1i(location, value)'\n}\n\nvar GLSL_TO_ARRAY_SETTERS = {\n\n 'float': 'uniform1fv(location, value)',\n\n 'vec2': 'uniform2fv(location, value)',\n 'vec3': 'uniform3fv(location, value)',\n 'vec4': 'uniform4fv(location, value)',\n\n 'int': 'uniform1iv(location, value)',\n 'ivec2': 'uniform2iv(location, value)',\n 'ivec3': 'uniform3iv(location, value)',\n 'ivec4': 'uniform4iv(location, value)',\n\n 'bool': 'uniform1iv(location, value)',\n 'bvec2': 'uniform2iv(location, value)',\n 'bvec3': 'uniform3iv(location, value)',\n 'bvec4': 'uniform4iv(location, value)',\n\n 'sampler2D':'uniform1iv(location, value)'\n}\n\nmodule.exports = generateUniformAccessObject;\n\n},{}],14:[function(require,module,exports){\n\n\nvar mapSize = function(type) \n{ \n return GLSL_TO_SIZE[type];\n}\n\n\nvar GLSL_TO_SIZE = {\n 'float': 1,\n 'vec2': 2,\n 'vec3': 3,\n 'vec4': 4,\n\n 'int': 1,\n 'ivec2': 2,\n 'ivec3': 3,\n 'ivec4': 4,\n\n 'bool': 1,\n 'bvec2': 2,\n 'bvec3': 3,\n 'bvec4': 4,\n\n 'mat2': 4,\n 'mat3': 9,\n 'mat4': 16,\n\n 'sampler2D': 1\n}\n\nmodule.exports = mapSize;\n\n},{}],15:[function(require,module,exports){\n\n\nvar mapSize = function(gl, type) \n{\n if(!GL_TABLE) \n {\n var typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for(var i = 0; i < typeNames.length; ++i) \n {\n var tn = typeNames[i];\n GL_TABLE[ gl[tn] ] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n\nvar GL_TABLE = null;\n\nvar GL_TO_GLSL_TYPES = {\n 'FLOAT': 'float',\n 'FLOAT_VEC2': 'vec2',\n 'FLOAT_VEC3': 'vec3',\n 'FLOAT_VEC4': 'vec4',\n\n 'INT': 'int',\n 'INT_VEC2': 'ivec2',\n 'INT_VEC3': 'ivec3',\n 'INT_VEC4': 'ivec4',\n \n 'BOOL': 'bool',\n 'BOOL_VEC2': 'bvec2',\n 'BOOL_VEC3': 'bvec3',\n 'BOOL_VEC4': 'bvec4',\n \n 'FLOAT_MAT2': 'mat2',\n 'FLOAT_MAT3': 'mat3',\n 'FLOAT_MAT4': 'mat4',\n \n 'SAMPLER_2D': 'sampler2D' \n}\n\nmodule.exports = mapSize;\n\n},{}],16:[function(require,module,exports){\n(function (process,global){\n/*!\n * async\n * https://github.com/caolan/async\n *\n * Copyright 2010-2014 Caolan McMahon\n * Released under the MIT license\n */\n(function () {\n\n var async = {};\n function noop() {}\n function identity(v) {\n return v;\n }\n function toBool(v) {\n return !!v;\n }\n function notId(v) {\n return !v;\n }\n\n // global on the server, window in the browser\n var previous_async;\n\n // Establish the root object, `window` (`self`) in the browser, `global`\n // on the server, or `this` in some virtual machines. We use `self`\n // instead of `window` for `WebWorker` support.\n var root = typeof self === 'object' && self.self === self && self ||\n typeof global === 'object' && global.global === global && global ||\n this;\n\n if (root != null) {\n previous_async = root.async;\n }\n\n async.noConflict = function () {\n root.async = previous_async;\n return async;\n };\n\n function only_once(fn) {\n return function() {\n if (fn === null) throw new Error(\"Callback was already called.\");\n fn.apply(this, arguments);\n fn = null;\n };\n }\n\n function _once(fn) {\n return function() {\n if (fn === null) return;\n fn.apply(this, arguments);\n fn = null;\n };\n }\n\n //// cross-browser compatiblity functions ////\n\n var _toString = Object.prototype.toString;\n\n var _isArray = Array.isArray || function (obj) {\n return _toString.call(obj) === '[object Array]';\n };\n\n // Ported from underscore.js isObject\n var _isObject = function(obj) {\n var type = typeof obj;\n return type === 'function' || type === 'object' && !!obj;\n };\n\n function _isArrayLike(arr) {\n return _isArray(arr) || (\n // has a positive integer length property\n typeof arr.length === \"number\" &&\n arr.length >= 0 &&\n arr.length % 1 === 0\n );\n }\n\n function _arrayEach(arr, iterator) {\n var index = -1,\n length = arr.length;\n\n while (++index < length) {\n iterator(arr[index], index, arr);\n }\n }\n\n function _map(arr, iterator) {\n var index = -1,\n length = arr.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iterator(arr[index], index, arr);\n }\n return result;\n }\n\n function _range(count) {\n return _map(Array(count), function (v, i) { return i; });\n }\n\n function _reduce(arr, iterator, memo) {\n _arrayEach(arr, function (x, i, a) {\n memo = iterator(memo, x, i, a);\n });\n return memo;\n }\n\n function _forEachOf(object, iterator) {\n _arrayEach(_keys(object), function (key) {\n iterator(object[key], key);\n });\n }\n\n function _indexOf(arr, item) {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] === item) return i;\n }\n return -1;\n }\n\n var _keys = Object.keys || function (obj) {\n var keys = [];\n for (var k in obj) {\n if (obj.hasOwnProperty(k)) {\n keys.push(k);\n }\n }\n return keys;\n };\n\n function _keyIterator(coll) {\n var i = -1;\n var len;\n var keys;\n if (_isArrayLike(coll)) {\n len = coll.length;\n return function next() {\n i++;\n return i < len ? i : null;\n };\n } else {\n keys = _keys(coll);\n len = keys.length;\n return function next() {\n i++;\n return i < len ? keys[i] : null;\n };\n }\n }\n\n // Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html)\n // This accumulates the arguments passed into an array, after a given index.\n // From underscore.js (https://github.com/jashkenas/underscore/pull/2140).\n function _restParam(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0);\n var rest = Array(length);\n for (var index = 0; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n }\n // Currently unused but handle cases outside of the switch statement:\n // var args = Array(startIndex + 1);\n // for (index = 0; index < startIndex; index++) {\n // args[index] = arguments[index];\n // }\n // args[startIndex] = rest;\n // return func.apply(this, args);\n };\n }\n\n function _withoutIndex(iterator) {\n return function (value, index, callback) {\n return iterator(value, callback);\n };\n }\n\n //// exported async module functions ////\n\n //// nextTick implementation with browser-compatible fallback ////\n\n // capture the global reference to guard against fakeTimer mocks\n var _setImmediate = typeof setImmediate === 'function' && setImmediate;\n\n var _delay = _setImmediate ? function(fn) {\n // not a direct alias for IE10 compatibility\n _setImmediate(fn);\n } : function(fn) {\n setTimeout(fn, 0);\n };\n\n if (typeof process === 'object' && typeof process.nextTick === 'function') {\n async.nextTick = process.nextTick;\n } else {\n async.nextTick = _delay;\n }\n async.setImmediate = _setImmediate ? _delay : async.nextTick;\n\n\n async.forEach =\n async.each = function (arr, iterator, callback) {\n return async.eachOf(arr, _withoutIndex(iterator), callback);\n };\n\n async.forEachSeries =\n async.eachSeries = function (arr, iterator, callback) {\n return async.eachOfSeries(arr, _withoutIndex(iterator), callback);\n };\n\n\n async.forEachLimit =\n async.eachLimit = function (arr, limit, iterator, callback) {\n return _eachOfLimit(limit)(arr, _withoutIndex(iterator), callback);\n };\n\n async.forEachOf =\n async.eachOf = function (object, iterator, callback) {\n callback = _once(callback || noop);\n object = object || [];\n\n var iter = _keyIterator(object);\n var key, completed = 0;\n\n while ((key = iter()) != null) {\n completed += 1;\n iterator(object[key], key, only_once(done));\n }\n\n if (completed === 0) callback(null);\n\n function done(err) {\n completed--;\n if (err) {\n callback(err);\n }\n // Check key is null in case iterator isn't exhausted\n // and done resolved synchronously.\n else if (key === null && completed <= 0) {\n callback(null);\n }\n }\n };\n\n async.forEachOfSeries =\n async.eachOfSeries = function (obj, iterator, callback) {\n callback = _once(callback || noop);\n obj = obj || [];\n var nextKey = _keyIterator(obj);\n var key = nextKey();\n function iterate() {\n var sync = true;\n if (key === null) {\n return callback(null);\n }\n iterator(obj[key], key, only_once(function (err) {\n if (err) {\n callback(err);\n }\n else {\n key = nextKey();\n if (key === null) {\n return callback(null);\n } else {\n if (sync) {\n async.setImmediate(iterate);\n } else {\n iterate();\n }\n }\n }\n }));\n sync = false;\n }\n iterate();\n };\n\n\n\n async.forEachOfLimit =\n async.eachOfLimit = function (obj, limit, iterator, callback) {\n _eachOfLimit(limit)(obj, iterator, callback);\n };\n\n function _eachOfLimit(limit) {\n\n return function (obj, iterator, callback) {\n callback = _once(callback || noop);\n obj = obj || [];\n var nextKey = _keyIterator(obj);\n if (limit <= 0) {\n return callback(null);\n }\n var done = false;\n var running = 0;\n var errored = false;\n\n (function replenish () {\n if (done && running <= 0) {\n return callback(null);\n }\n\n while (running < limit && !errored) {\n var key = nextKey();\n if (key === null) {\n done = true;\n if (running <= 0) {\n callback(null);\n }\n return;\n }\n running += 1;\n iterator(obj[key], key, only_once(function (err) {\n running -= 1;\n if (err) {\n callback(err);\n errored = true;\n }\n else {\n replenish();\n }\n }));\n }\n })();\n };\n }\n\n\n function doParallel(fn) {\n return function (obj, iterator, callback) {\n return fn(async.eachOf, obj, iterator, callback);\n };\n }\n function doParallelLimit(fn) {\n return function (obj, limit, iterator, callback) {\n return fn(_eachOfLimit(limit), obj, iterator, callback);\n };\n }\n function doSeries(fn) {\n return function (obj, iterator, callback) {\n return fn(async.eachOfSeries, obj, iterator, callback);\n };\n }\n\n function _asyncMap(eachfn, arr, iterator, callback) {\n callback = _once(callback || noop);\n arr = arr || [];\n var results = _isArrayLike(arr) ? [] : {};\n eachfn(arr, function (value, index, callback) {\n iterator(value, function (err, v) {\n results[index] = v;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n }\n\n async.map = doParallel(_asyncMap);\n async.mapSeries = doSeries(_asyncMap);\n async.mapLimit = doParallelLimit(_asyncMap);\n\n // reduce only has a series version, as doing reduce in parallel won't\n // work in many situations.\n async.inject =\n async.foldl =\n async.reduce = function (arr, memo, iterator, callback) {\n async.eachOfSeries(arr, function (x, i, callback) {\n iterator(memo, x, function (err, v) {\n memo = v;\n callback(err);\n });\n }, function (err) {\n callback(err, memo);\n });\n };\n\n async.foldr =\n async.reduceRight = function (arr, memo, iterator, callback) {\n var reversed = _map(arr, identity).reverse();\n async.reduce(reversed, memo, iterator, callback);\n };\n\n async.transform = function (arr, memo, iterator, callback) {\n if (arguments.length === 3) {\n callback = iterator;\n iterator = memo;\n memo = _isArray(arr) ? [] : {};\n }\n\n async.eachOf(arr, function(v, k, cb) {\n iterator(memo, v, k, cb);\n }, function(err) {\n callback(err, memo);\n });\n };\n\n function _filter(eachfn, arr, iterator, callback) {\n var results = [];\n eachfn(arr, function (x, index, callback) {\n iterator(x, function (v) {\n if (v) {\n results.push({index: index, value: x});\n }\n callback();\n });\n }, function () {\n callback(_map(results.sort(function (a, b) {\n return a.index - b.index;\n }), function (x) {\n return x.value;\n }));\n });\n }\n\n async.select =\n async.filter = doParallel(_filter);\n\n async.selectLimit =\n async.filterLimit = doParallelLimit(_filter);\n\n async.selectSeries =\n async.filterSeries = doSeries(_filter);\n\n function _reject(eachfn, arr, iterator, callback) {\n _filter(eachfn, arr, function(value, cb) {\n iterator(value, function(v) {\n cb(!v);\n });\n }, callback);\n }\n async.reject = doParallel(_reject);\n async.rejectLimit = doParallelLimit(_reject);\n async.rejectSeries = doSeries(_reject);\n\n function _createTester(eachfn, check, getResult) {\n return function(arr, limit, iterator, cb) {\n function done() {\n if (cb) cb(getResult(false, void 0));\n }\n function iteratee(x, _, callback) {\n if (!cb) return callback();\n iterator(x, function (v) {\n if (cb && check(v)) {\n cb(getResult(true, x));\n cb = iterator = false;\n }\n callback();\n });\n }\n if (arguments.length > 3) {\n eachfn(arr, limit, iteratee, done);\n } else {\n cb = iterator;\n iterator = limit;\n eachfn(arr, iteratee, done);\n }\n };\n }\n\n async.any =\n async.some = _createTester(async.eachOf, toBool, identity);\n\n async.someLimit = _createTester(async.eachOfLimit, toBool, identity);\n\n async.all =\n async.every = _createTester(async.eachOf, notId, notId);\n\n async.everyLimit = _createTester(async.eachOfLimit, notId, notId);\n\n function _findGetResult(v, x) {\n return x;\n }\n async.detect = _createTester(async.eachOf, identity, _findGetResult);\n async.detectSeries = _createTester(async.eachOfSeries, identity, _findGetResult);\n async.detectLimit = _createTester(async.eachOfLimit, identity, _findGetResult);\n\n async.sortBy = function (arr, iterator, callback) {\n async.map(arr, function (x, callback) {\n iterator(x, function (err, criteria) {\n if (err) {\n callback(err);\n }\n else {\n callback(null, {value: x, criteria: criteria});\n }\n });\n }, function (err, results) {\n if (err) {\n return callback(err);\n }\n else {\n callback(null, _map(results.sort(comparator), function (x) {\n return x.value;\n }));\n }\n\n });\n\n function comparator(left, right) {\n var a = left.criteria, b = right.criteria;\n return a < b ? -1 : a > b ? 1 : 0;\n }\n };\n\n async.auto = function (tasks, concurrency, callback) {\n if (typeof arguments[1] === 'function') {\n // concurrency is optional, shift the args.\n callback = concurrency;\n concurrency = null;\n }\n callback = _once(callback || noop);\n var keys = _keys(tasks);\n var remainingTasks = keys.length;\n if (!remainingTasks) {\n return callback(null);\n }\n if (!concurrency) {\n concurrency = remainingTasks;\n }\n\n var results = {};\n var runningTasks = 0;\n\n var hasError = false;\n\n var listeners = [];\n function addListener(fn) {\n listeners.unshift(fn);\n }\n function removeListener(fn) {\n var idx = _indexOf(listeners, fn);\n if (idx >= 0) listeners.splice(idx, 1);\n }\n function taskComplete() {\n remainingTasks--;\n _arrayEach(listeners.slice(0), function (fn) {\n fn();\n });\n }\n\n addListener(function () {\n if (!remainingTasks) {\n callback(null, results);\n }\n });\n\n _arrayEach(keys, function (k) {\n if (hasError) return;\n var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];\n var taskCallback = _restParam(function(err, args) {\n runningTasks--;\n if (args.length <= 1) {\n args = args[0];\n }\n if (err) {\n var safeResults = {};\n _forEachOf(results, function(val, rkey) {\n safeResults[rkey] = val;\n });\n safeResults[k] = args;\n hasError = true;\n\n callback(err, safeResults);\n }\n else {\n results[k] = args;\n async.setImmediate(taskComplete);\n }\n });\n var requires = task.slice(0, task.length - 1);\n // prevent dead-locks\n var len = requires.length;\n var dep;\n while (len--) {\n if (!(dep = tasks[requires[len]])) {\n throw new Error('Has nonexistent dependency in ' + requires.join(', '));\n }\n if (_isArray(dep) && _indexOf(dep, k) >= 0) {\n throw new Error('Has cyclic dependencies');\n }\n }\n function ready() {\n return runningTasks < concurrency && _reduce(requires, function (a, x) {\n return (a && results.hasOwnProperty(x));\n }, true) && !results.hasOwnProperty(k);\n }\n if (ready()) {\n runningTasks++;\n task[task.length - 1](taskCallback, results);\n }\n else {\n addListener(listener);\n }\n function listener() {\n if (ready()) {\n runningTasks++;\n removeListener(listener);\n task[task.length - 1](taskCallback, results);\n }\n }\n });\n };\n\n\n\n async.retry = function(times, task, callback) {\n var DEFAULT_TIMES = 5;\n var DEFAULT_INTERVAL = 0;\n\n var attempts = [];\n\n var opts = {\n times: DEFAULT_TIMES,\n interval: DEFAULT_INTERVAL\n };\n\n function parseTimes(acc, t){\n if(typeof t === 'number'){\n acc.times = parseInt(t, 10) || DEFAULT_TIMES;\n } else if(typeof t === 'object'){\n acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;\n acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;\n } else {\n throw new Error('Unsupported argument type for \\'times\\': ' + typeof t);\n }\n }\n\n var length = arguments.length;\n if (length < 1 || length > 3) {\n throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)');\n } else if (length <= 2 && typeof times === 'function') {\n callback = task;\n task = times;\n }\n if (typeof times !== 'function') {\n parseTimes(opts, times);\n }\n opts.callback = callback;\n opts.task = task;\n\n function wrappedTask(wrappedCallback, wrappedResults) {\n function retryAttempt(task, finalAttempt) {\n return function(seriesCallback) {\n task(function(err, result){\n seriesCallback(!err || finalAttempt, {err: err, result: result});\n }, wrappedResults);\n };\n }\n\n function retryInterval(interval){\n return function(seriesCallback){\n setTimeout(function(){\n seriesCallback(null);\n }, interval);\n };\n }\n\n while (opts.times) {\n\n var finalAttempt = !(opts.times-=1);\n attempts.push(retryAttempt(opts.task, finalAttempt));\n if(!finalAttempt && opts.interval > 0){\n attempts.push(retryInterval(opts.interval));\n }\n }\n\n async.series(attempts, function(done, data){\n data = data[data.length - 1];\n (wrappedCallback || opts.callback)(data.err, data.result);\n });\n }\n\n // If a callback is passed, run this as a controll flow\n return opts.callback ? wrappedTask() : wrappedTask;\n };\n\n async.waterfall = function (tasks, callback) {\n callback = _once(callback || noop);\n if (!_isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n function wrapIterator(iterator) {\n return _restParam(function (err, args) {\n if (err) {\n callback.apply(null, [err].concat(args));\n }\n else {\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n ensureAsync(iterator).apply(null, args);\n }\n });\n }\n wrapIterator(async.iterator(tasks))();\n };\n\n function _parallel(eachfn, tasks, callback) {\n callback = callback || noop;\n var results = _isArrayLike(tasks) ? [] : {};\n\n eachfn(tasks, function (task, key, callback) {\n task(_restParam(function (err, args) {\n if (args.length <= 1) {\n args = args[0];\n }\n results[key] = args;\n callback(err);\n }));\n }, function (err) {\n callback(err, results);\n });\n }\n\n async.parallel = function (tasks, callback) {\n _parallel(async.eachOf, tasks, callback);\n };\n\n async.parallelLimit = function(tasks, limit, callback) {\n _parallel(_eachOfLimit(limit), tasks, callback);\n };\n\n async.series = function(tasks, callback) {\n _parallel(async.eachOfSeries, tasks, callback);\n };\n\n async.iterator = function (tasks) {\n function makeCallback(index) {\n function fn() {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n }\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1): null;\n };\n return fn;\n }\n return makeCallback(0);\n };\n\n async.apply = _restParam(function (fn, args) {\n return _restParam(function (callArgs) {\n return fn.apply(\n null, args.concat(callArgs)\n );\n });\n });\n\n function _concat(eachfn, arr, fn, callback) {\n var result = [];\n eachfn(arr, function (x, index, cb) {\n fn(x, function (err, y) {\n result = result.concat(y || []);\n cb(err);\n });\n }, function (err) {\n callback(err, result);\n });\n }\n async.concat = doParallel(_concat);\n async.concatSeries = doSeries(_concat);\n\n async.whilst = function (test, iterator, callback) {\n callback = callback || noop;\n if (test()) {\n var next = _restParam(function(err, args) {\n if (err) {\n callback(err);\n } else if (test.apply(this, args)) {\n iterator(next);\n } else {\n callback.apply(null, [null].concat(args));\n }\n });\n iterator(next);\n } else {\n callback(null);\n }\n };\n\n async.doWhilst = function (iterator, test, callback) {\n var calls = 0;\n return async.whilst(function() {\n return ++calls <= 1 || test.apply(this, arguments);\n }, iterator, callback);\n };\n\n async.until = function (test, iterator, callback) {\n return async.whilst(function() {\n return !test.apply(this, arguments);\n }, iterator, callback);\n };\n\n async.doUntil = function (iterator, test, callback) {\n return async.doWhilst(iterator, function() {\n return !test.apply(this, arguments);\n }, callback);\n };\n\n async.during = function (test, iterator, callback) {\n callback = callback || noop;\n\n var next = _restParam(function(err, args) {\n if (err) {\n callback(err);\n } else {\n args.push(check);\n test.apply(this, args);\n }\n });\n\n var check = function(err, truth) {\n if (err) {\n callback(err);\n } else if (truth) {\n iterator(next);\n } else {\n callback(null);\n }\n };\n\n test(check);\n };\n\n async.doDuring = function (iterator, test, callback) {\n var calls = 0;\n async.during(function(next) {\n if (calls++ < 1) {\n next(null, true);\n } else {\n test.apply(this, arguments);\n }\n }, iterator, callback);\n };\n\n function _queue(worker, concurrency, payload) {\n if (concurrency == null) {\n concurrency = 1;\n }\n else if(concurrency === 0) {\n throw new Error('Concurrency must not be zero');\n }\n function _insert(q, data, pos, callback) {\n if (callback != null && typeof callback !== \"function\") {\n throw new Error(\"task callback must be a function\");\n }\n q.started = true;\n if (!_isArray(data)) {\n data = [data];\n }\n if(data.length === 0 && q.idle()) {\n // call drain immediately if there are no tasks\n return async.setImmediate(function() {\n q.drain();\n });\n }\n _arrayEach(data, function(task) {\n var item = {\n data: task,\n callback: callback || noop\n };\n\n if (pos) {\n q.tasks.unshift(item);\n } else {\n q.tasks.push(item);\n }\n\n if (q.tasks.length === q.concurrency) {\n q.saturated();\n }\n });\n async.setImmediate(q.process);\n }\n function _next(q, tasks) {\n return function(){\n workers -= 1;\n\n var removed = false;\n var args = arguments;\n _arrayEach(tasks, function (task) {\n _arrayEach(workersList, function (worker, index) {\n if (worker === task && !removed) {\n workersList.splice(index, 1);\n removed = true;\n }\n });\n\n task.callback.apply(task, args);\n });\n if (q.tasks.length + workers === 0) {\n q.drain();\n }\n q.process();\n };\n }\n\n var workers = 0;\n var workersList = [];\n var q = {\n tasks: [],\n concurrency: concurrency,\n payload: payload,\n saturated: noop,\n empty: noop,\n drain: noop,\n started: false,\n paused: false,\n push: function (data, callback) {\n _insert(q, data, false, callback);\n },\n kill: function () {\n q.drain = noop;\n q.tasks = [];\n },\n unshift: function (data, callback) {\n _insert(q, data, true, callback);\n },\n process: function () {\n while(!q.paused && workers < q.concurrency && q.tasks.length){\n\n var tasks = q.payload ?\n q.tasks.splice(0, q.payload) :\n q.tasks.splice(0, q.tasks.length);\n\n var data = _map(tasks, function (task) {\n return task.data;\n });\n\n if (q.tasks.length === 0) {\n q.empty();\n }\n workers += 1;\n workersList.push(tasks[0]);\n var cb = only_once(_next(q, tasks));\n worker(data, cb);\n }\n },\n length: function () {\n return q.tasks.length;\n },\n running: function () {\n return workers;\n },\n workersList: function () {\n return workersList;\n },\n idle: function() {\n return q.tasks.length + workers === 0;\n },\n pause: function () {\n q.paused = true;\n },\n resume: function () {\n if (q.paused === false) { return; }\n q.paused = false;\n var resumeCount = Math.min(q.concurrency, q.tasks.length);\n // Need to call q.process once per concurrent\n // worker to preserve full concurrency after pause\n for (var w = 1; w <= resumeCount; w++) {\n async.setImmediate(q.process);\n }\n }\n };\n return q;\n }\n\n async.queue = function (worker, concurrency) {\n var q = _queue(function (items, cb) {\n worker(items[0], cb);\n }, concurrency, 1);\n\n return q;\n };\n\n async.priorityQueue = function (worker, concurrency) {\n\n function _compareTasks(a, b){\n return a.priority - b.priority;\n }\n\n function _binarySearch(sequence, item, compare) {\n var beg = -1,\n end = sequence.length - 1;\n while (beg < end) {\n var mid = beg + ((end - beg + 1) >>> 1);\n if (compare(item, sequence[mid]) >= 0) {\n beg = mid;\n } else {\n end = mid - 1;\n }\n }\n return beg;\n }\n\n function _insert(q, data, priority, callback) {\n if (callback != null && typeof callback !== \"function\") {\n throw new Error(\"task callback must be a function\");\n }\n q.started = true;\n if (!_isArray(data)) {\n data = [data];\n }\n if(data.length === 0) {\n // call drain immediately if there are no tasks\n return async.setImmediate(function() {\n q.drain();\n });\n }\n _arrayEach(data, function(task) {\n var item = {\n data: task,\n priority: priority,\n callback: typeof callback === 'function' ? callback : noop\n };\n\n q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);\n\n if (q.tasks.length === q.concurrency) {\n q.saturated();\n }\n async.setImmediate(q.process);\n });\n }\n\n // Start with a normal queue\n var q = async.queue(worker, concurrency);\n\n // Override push to accept second parameter representing priority\n q.push = function (data, priority, callback) {\n _insert(q, data, priority, callback);\n };\n\n // Remove unshift function\n delete q.unshift;\n\n return q;\n };\n\n async.cargo = function (worker, payload) {\n return _queue(worker, 1, payload);\n };\n\n function _console_fn(name) {\n return _restParam(function (fn, args) {\n fn.apply(null, args.concat([_restParam(function (err, args) {\n if (typeof console === 'object') {\n if (err) {\n if (console.error) {\n console.error(err);\n }\n }\n else if (console[name]) {\n _arrayEach(args, function (x) {\n console[name](x);\n });\n }\n }\n })]));\n });\n }\n async.log = _console_fn('log');\n async.dir = _console_fn('dir');\n /*async.info = _console_fn('info');\n async.warn = _console_fn('warn');\n async.error = _console_fn('error');*/\n\n async.memoize = function (fn, hasher) {\n var memo = {};\n var queues = {};\n var has = Object.prototype.hasOwnProperty;\n hasher = hasher || identity;\n var memoized = _restParam(function memoized(args) {\n var callback = args.pop();\n var key = hasher.apply(null, args);\n if (has.call(memo, key)) { \n async.setImmediate(function () {\n callback.apply(null, memo[key]);\n });\n }\n else if (has.call(queues, key)) {\n queues[key].push(callback);\n }\n else {\n queues[key] = [callback];\n fn.apply(null, args.concat([_restParam(function (args) {\n memo[key] = args;\n var q = queues[key];\n delete queues[key];\n for (var i = 0, l = q.length; i < l; i++) {\n q[i].apply(null, args);\n }\n })]));\n }\n });\n memoized.memo = memo;\n memoized.unmemoized = fn;\n return memoized;\n };\n\n async.unmemoize = function (fn) {\n return function () {\n return (fn.unmemoized || fn).apply(null, arguments);\n };\n };\n\n function _times(mapper) {\n return function (count, iterator, callback) {\n mapper(_range(count), iterator, callback);\n };\n }\n\n async.times = _times(async.map);\n async.timesSeries = _times(async.mapSeries);\n async.timesLimit = function (count, limit, iterator, callback) {\n return async.mapLimit(_range(count), limit, iterator, callback);\n };\n\n async.seq = function (/* functions... */) {\n var fns = arguments;\n return _restParam(function (args) {\n var that = this;\n\n var callback = args[args.length - 1];\n if (typeof callback == 'function') {\n args.pop();\n } else {\n callback = noop;\n }\n\n async.reduce(fns, args, function (newargs, fn, cb) {\n fn.apply(that, newargs.concat([_restParam(function (err, nextargs) {\n cb(err, nextargs);\n })]));\n },\n function (err, results) {\n callback.apply(that, [err].concat(results));\n });\n });\n };\n\n async.compose = function (/* functions... */) {\n return async.seq.apply(null, Array.prototype.reverse.call(arguments));\n };\n\n\n function _applyEach(eachfn) {\n return _restParam(function(fns, args) {\n var go = _restParam(function(args) {\n var that = this;\n var callback = args.pop();\n return eachfn(fns, function (fn, _, cb) {\n fn.apply(that, args.concat([cb]));\n },\n callback);\n });\n if (args.length) {\n return go.apply(this, args);\n }\n else {\n return go;\n }\n });\n }\n\n async.applyEach = _applyEach(async.eachOf);\n async.applyEachSeries = _applyEach(async.eachOfSeries);\n\n\n async.forever = function (fn, callback) {\n var done = only_once(callback || noop);\n var task = ensureAsync(fn);\n function next(err) {\n if (err) {\n return done(err);\n }\n task(next);\n }\n next();\n };\n\n function ensureAsync(fn) {\n return _restParam(function (args) {\n var callback = args.pop();\n args.push(function () {\n var innerArgs = arguments;\n if (sync) {\n async.setImmediate(function () {\n callback.apply(null, innerArgs);\n });\n } else {\n callback.apply(null, innerArgs);\n }\n });\n var sync = true;\n fn.apply(this, args);\n sync = false;\n });\n }\n\n async.ensureAsync = ensureAsync;\n\n async.constant = _restParam(function(values) {\n var args = [null].concat(values);\n return function (callback) {\n return callback.apply(this, args);\n };\n });\n\n async.wrapSync =\n async.asyncify = function asyncify(func) {\n return _restParam(function (args) {\n var callback = args.pop();\n var result;\n try {\n result = func.apply(this, args);\n } catch (e) {\n return callback(e);\n }\n // if result is Promise object\n if (_isObject(result) && typeof result.then === \"function\") {\n result.then(function(value) {\n callback(null, value);\n })[\"catch\"](function(err) {\n callback(err.message ? err : new Error(err));\n });\n } else {\n callback(null, result);\n }\n });\n };\n\n // Node.js\n if (typeof module === 'object' && module.exports) {\n module.exports = async;\n }\n // AMD / RequireJS\n else if (typeof define === 'function' && define.amd) {\n define([], function () {\n return async;\n });\n }\n // included directly via