diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/math/index.js b/src/core/math/index.js index cc176e9..0e7a562 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -3,7 +3,7 @@ */ module.exports = { /** - * @property {number} PI_2 - Math.PI x 2 + * @property {number} PI_2 - Two Pi * @constant * @static */ diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/math/index.js b/src/core/math/index.js index cc176e9..0e7a562 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -3,7 +3,7 @@ */ module.exports = { /** - * @property {number} PI_2 - Math.PI x 2 + * @property {number} PI_2 - Two Pi * @constant * @static */ diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 464edcc..27664c2 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -21,7 +21,10 @@ * And here you have a hundred sprites that will be renderer at the speed of light. * * @class + * @extends Container * @namespace PIXI + * + * @param size {number} The number of images in the SpriteBatch before it flushes. */ function ParticleContainer(size, properties) { @@ -55,7 +58,7 @@ }; /** - * Renders the object using the WebGL renderer + * Renders the container using the WebGL renderer * * @param renderer {WebGLRenderer} The webgl renderer * @private @@ -71,6 +74,13 @@ renderer.plugins.particle.render( this ); }; +/** + * Adds a child to this particle container at a specified index. If the index is out of bounds an error will be thrown + * + * @param child {DisplayObject} The child to add + * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. + */ ParticleContainer.prototype.addChildAt = function (child, index) { // prevent adding self as child diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/math/index.js b/src/core/math/index.js index cc176e9..0e7a562 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -3,7 +3,7 @@ */ module.exports = { /** - * @property {number} PI_2 - Math.PI x 2 + * @property {number} PI_2 - Two Pi * @constant * @static */ diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 464edcc..27664c2 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -21,7 +21,10 @@ * And here you have a hundred sprites that will be renderer at the speed of light. * * @class + * @extends Container * @namespace PIXI + * + * @param size {number} The number of images in the SpriteBatch before it flushes. */ function ParticleContainer(size, properties) { @@ -55,7 +58,7 @@ }; /** - * Renders the object using the WebGL renderer + * Renders the container using the WebGL renderer * * @param renderer {WebGLRenderer} The webgl renderer * @private @@ -71,6 +74,13 @@ renderer.plugins.particle.render( this ); }; +/** + * Adds a child to this particle container at a specified index. If the index is out of bounds an error will be thrown + * + * @param child {DisplayObject} The child to add + * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. + */ ParticleContainer.prototype.addChildAt = function (child, index) { // prevent adding self as child diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index abc8317..73eae2e 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -19,6 +19,9 @@ */ function ParticleBuffer(gl, properties, size) { + /** + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; /** @@ -42,7 +45,18 @@ */ this.size = size; + /** + * + * + * @member {Array} + */ this.dynamicProperties = []; + + /** + * + * + * @member {Array} + */ this.staticProperties = []; for (var i = 0; i < properties.length; i++) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/math/index.js b/src/core/math/index.js index cc176e9..0e7a562 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -3,7 +3,7 @@ */ module.exports = { /** - * @property {number} PI_2 - Math.PI x 2 + * @property {number} PI_2 - Two Pi * @constant * @static */ diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 464edcc..27664c2 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -21,7 +21,10 @@ * And here you have a hundred sprites that will be renderer at the speed of light. * * @class + * @extends Container * @namespace PIXI + * + * @param size {number} The number of images in the SpriteBatch before it flushes. */ function ParticleContainer(size, properties) { @@ -55,7 +58,7 @@ }; /** - * Renders the object using the WebGL renderer + * Renders the container using the WebGL renderer * * @param renderer {WebGLRenderer} The webgl renderer * @private @@ -71,6 +74,13 @@ renderer.plugins.particle.render( this ); }; +/** + * Adds a child to this particle container at a specified index. If the index is out of bounds an error will be thrown + * + * @param child {DisplayObject} The child to add + * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. + */ ParticleContainer.prototype.addChildAt = function (child, index) { // prevent adding self as child diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index abc8317..73eae2e 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -19,6 +19,9 @@ */ function ParticleBuffer(gl, properties, size) { + /** + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; /** @@ -42,7 +45,18 @@ */ this.size = size; + /** + * + * + * @member {Array} + */ this.dynamicProperties = []; + + /** + * + * + * @member {Array} + */ this.staticProperties = []; for (var i = 0; i < properties.length; i++) diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 56213f0..4b46eb0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -75,10 +75,10 @@ WebGLRenderer.registerPlugin('particle', ParticleRenderer); /** - * Sets up the renderer context and necessary buffers. + * When there is a WebGL context change * * @private - * @param gl {WebGLRenderingContext} the current WebGL drawing context + * */ ParticleRenderer.prototype.onContextChange = function () { @@ -164,7 +164,7 @@ /** * Renders the sprite object. * - * @param sprite {Sprite} the sprite to render when using this Particle + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer */ ParticleRenderer.prototype.render = function ( container ) { @@ -247,6 +247,11 @@ container._updateStatic = false; }; +/** + * Creates one particle buffer for each child in the container we want to render and updates internal properties + * + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer + */ ParticleRenderer.prototype.generateBuffers = function ( container ) { var gl = this.renderer.gl, @@ -269,7 +274,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their vertices uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadVerticies = function (children, startIndex, amount, array, stride, offset) { var sprite, @@ -323,7 +336,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their positions uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadPosition = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -347,6 +368,15 @@ }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their rotation uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadRotation = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -363,6 +393,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their Uvs uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadUvs = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -405,6 +444,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their alpha uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadAlpha = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -432,5 +480,3 @@ //TODO implement this! }; - - diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/math/index.js b/src/core/math/index.js index cc176e9..0e7a562 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -3,7 +3,7 @@ */ module.exports = { /** - * @property {number} PI_2 - Math.PI x 2 + * @property {number} PI_2 - Two Pi * @constant * @static */ diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 464edcc..27664c2 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -21,7 +21,10 @@ * And here you have a hundred sprites that will be renderer at the speed of light. * * @class + * @extends Container * @namespace PIXI + * + * @param size {number} The number of images in the SpriteBatch before it flushes. */ function ParticleContainer(size, properties) { @@ -55,7 +58,7 @@ }; /** - * Renders the object using the WebGL renderer + * Renders the container using the WebGL renderer * * @param renderer {WebGLRenderer} The webgl renderer * @private @@ -71,6 +74,13 @@ renderer.plugins.particle.render( this ); }; +/** + * Adds a child to this particle container at a specified index. If the index is out of bounds an error will be thrown + * + * @param child {DisplayObject} The child to add + * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. + */ ParticleContainer.prototype.addChildAt = function (child, index) { // prevent adding self as child diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index abc8317..73eae2e 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -19,6 +19,9 @@ */ function ParticleBuffer(gl, properties, size) { + /** + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; /** @@ -42,7 +45,18 @@ */ this.size = size; + /** + * + * + * @member {Array} + */ this.dynamicProperties = []; + + /** + * + * + * @member {Array} + */ this.staticProperties = []; for (var i = 0; i < properties.length; i++) diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 56213f0..4b46eb0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -75,10 +75,10 @@ WebGLRenderer.registerPlugin('particle', ParticleRenderer); /** - * Sets up the renderer context and necessary buffers. + * When there is a WebGL context change * * @private - * @param gl {WebGLRenderingContext} the current WebGL drawing context + * */ ParticleRenderer.prototype.onContextChange = function () { @@ -164,7 +164,7 @@ /** * Renders the sprite object. * - * @param sprite {Sprite} the sprite to render when using this Particle + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer */ ParticleRenderer.prototype.render = function ( container ) { @@ -247,6 +247,11 @@ container._updateStatic = false; }; +/** + * Creates one particle buffer for each child in the container we want to render and updates internal properties + * + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer + */ ParticleRenderer.prototype.generateBuffers = function ( container ) { var gl = this.renderer.gl, @@ -269,7 +274,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their vertices uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadVerticies = function (children, startIndex, amount, array, stride, offset) { var sprite, @@ -323,7 +336,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their positions uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadPosition = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -347,6 +368,15 @@ }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their rotation uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadRotation = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -363,6 +393,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their Uvs uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadUvs = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -405,6 +444,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their alpha uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadAlpha = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -432,5 +480,3 @@ //TODO implement this! }; - - diff --git a/src/core/particles/webgl/ParticleShader.js b/src/core/particles/webgl/ParticleShader.js index 97836c2..096aef6 100644 --- a/src/core/particles/webgl/ParticleShader.js +++ b/src/core/particles/webgl/ParticleShader.js @@ -2,7 +2,7 @@ /** * @class - * @extends Shader + * @extends TextureShader * @namespace PIXI * @param shaderManager {ShaderManager} The webgl shader manager this shader works for. */ diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/math/index.js b/src/core/math/index.js index cc176e9..0e7a562 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -3,7 +3,7 @@ */ module.exports = { /** - * @property {number} PI_2 - Math.PI x 2 + * @property {number} PI_2 - Two Pi * @constant * @static */ diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 464edcc..27664c2 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -21,7 +21,10 @@ * And here you have a hundred sprites that will be renderer at the speed of light. * * @class + * @extends Container * @namespace PIXI + * + * @param size {number} The number of images in the SpriteBatch before it flushes. */ function ParticleContainer(size, properties) { @@ -55,7 +58,7 @@ }; /** - * Renders the object using the WebGL renderer + * Renders the container using the WebGL renderer * * @param renderer {WebGLRenderer} The webgl renderer * @private @@ -71,6 +74,13 @@ renderer.plugins.particle.render( this ); }; +/** + * Adds a child to this particle container at a specified index. If the index is out of bounds an error will be thrown + * + * @param child {DisplayObject} The child to add + * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. + */ ParticleContainer.prototype.addChildAt = function (child, index) { // prevent adding self as child diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index abc8317..73eae2e 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -19,6 +19,9 @@ */ function ParticleBuffer(gl, properties, size) { + /** + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; /** @@ -42,7 +45,18 @@ */ this.size = size; + /** + * + * + * @member {Array} + */ this.dynamicProperties = []; + + /** + * + * + * @member {Array} + */ this.staticProperties = []; for (var i = 0; i < properties.length; i++) diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 56213f0..4b46eb0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -75,10 +75,10 @@ WebGLRenderer.registerPlugin('particle', ParticleRenderer); /** - * Sets up the renderer context and necessary buffers. + * When there is a WebGL context change * * @private - * @param gl {WebGLRenderingContext} the current WebGL drawing context + * */ ParticleRenderer.prototype.onContextChange = function () { @@ -164,7 +164,7 @@ /** * Renders the sprite object. * - * @param sprite {Sprite} the sprite to render when using this Particle + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer */ ParticleRenderer.prototype.render = function ( container ) { @@ -247,6 +247,11 @@ container._updateStatic = false; }; +/** + * Creates one particle buffer for each child in the container we want to render and updates internal properties + * + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer + */ ParticleRenderer.prototype.generateBuffers = function ( container ) { var gl = this.renderer.gl, @@ -269,7 +274,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their vertices uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadVerticies = function (children, startIndex, amount, array, stride, offset) { var sprite, @@ -323,7 +336,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their positions uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadPosition = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -347,6 +368,15 @@ }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their rotation uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadRotation = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -363,6 +393,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their Uvs uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadUvs = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -405,6 +444,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their alpha uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadAlpha = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -432,5 +480,3 @@ //TODO implement this! }; - - diff --git a/src/core/particles/webgl/ParticleShader.js b/src/core/particles/webgl/ParticleShader.js index 97836c2..096aef6 100644 --- a/src/core/particles/webgl/ParticleShader.js +++ b/src/core/particles/webgl/ParticleShader.js @@ -2,7 +2,7 @@ /** * @class - * @extends Shader + * @extends TextureShader * @namespace PIXI * @param shaderManager {ShaderManager} The webgl shader manager this shader works for. */ diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index 486f010..e90d550 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -19,6 +19,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ function SpriteRenderer(renderer) @@ -66,7 +67,7 @@ this.positions = new Float32Array(this.vertices); /** - * View on the vertices as a Uint32Array + * Holds the color components * * @member {Uint32Array} */ diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/math/index.js b/src/core/math/index.js index cc176e9..0e7a562 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -3,7 +3,7 @@ */ module.exports = { /** - * @property {number} PI_2 - Math.PI x 2 + * @property {number} PI_2 - Two Pi * @constant * @static */ diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 464edcc..27664c2 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -21,7 +21,10 @@ * And here you have a hundred sprites that will be renderer at the speed of light. * * @class + * @extends Container * @namespace PIXI + * + * @param size {number} The number of images in the SpriteBatch before it flushes. */ function ParticleContainer(size, properties) { @@ -55,7 +58,7 @@ }; /** - * Renders the object using the WebGL renderer + * Renders the container using the WebGL renderer * * @param renderer {WebGLRenderer} The webgl renderer * @private @@ -71,6 +74,13 @@ renderer.plugins.particle.render( this ); }; +/** + * Adds a child to this particle container at a specified index. If the index is out of bounds an error will be thrown + * + * @param child {DisplayObject} The child to add + * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. + */ ParticleContainer.prototype.addChildAt = function (child, index) { // prevent adding self as child diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index abc8317..73eae2e 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -19,6 +19,9 @@ */ function ParticleBuffer(gl, properties, size) { + /** + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; /** @@ -42,7 +45,18 @@ */ this.size = size; + /** + * + * + * @member {Array} + */ this.dynamicProperties = []; + + /** + * + * + * @member {Array} + */ this.staticProperties = []; for (var i = 0; i < properties.length; i++) diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 56213f0..4b46eb0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -75,10 +75,10 @@ WebGLRenderer.registerPlugin('particle', ParticleRenderer); /** - * Sets up the renderer context and necessary buffers. + * When there is a WebGL context change * * @private - * @param gl {WebGLRenderingContext} the current WebGL drawing context + * */ ParticleRenderer.prototype.onContextChange = function () { @@ -164,7 +164,7 @@ /** * Renders the sprite object. * - * @param sprite {Sprite} the sprite to render when using this Particle + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer */ ParticleRenderer.prototype.render = function ( container ) { @@ -247,6 +247,11 @@ container._updateStatic = false; }; +/** + * Creates one particle buffer for each child in the container we want to render and updates internal properties + * + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer + */ ParticleRenderer.prototype.generateBuffers = function ( container ) { var gl = this.renderer.gl, @@ -269,7 +274,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their vertices uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadVerticies = function (children, startIndex, amount, array, stride, offset) { var sprite, @@ -323,7 +336,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their positions uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadPosition = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -347,6 +368,15 @@ }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their rotation uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadRotation = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -363,6 +393,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their Uvs uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadUvs = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -405,6 +444,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their alpha uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadAlpha = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -432,5 +480,3 @@ //TODO implement this! }; - - diff --git a/src/core/particles/webgl/ParticleShader.js b/src/core/particles/webgl/ParticleShader.js index 97836c2..096aef6 100644 --- a/src/core/particles/webgl/ParticleShader.js +++ b/src/core/particles/webgl/ParticleShader.js @@ -2,7 +2,7 @@ /** * @class - * @extends Shader + * @extends TextureShader * @namespace PIXI * @param shaderManager {ShaderManager} The webgl shader manager this shader works for. */ diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index 486f010..e90d550 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -19,6 +19,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ function SpriteRenderer(renderer) @@ -66,7 +67,7 @@ this.positions = new Float32Array(this.vertices); /** - * View on the vertices as a Uint32Array + * Holds the color components * * @member {Uint32Array} */ diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index c547872..f28bdfa 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -9,6 +9,7 @@ * @namespace PIXI * @param source {Image|Canvas} the source object of the texture. * @param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values + * @param resolution {number} the resolution of the texture for devices with different pixel ratios */ function BaseTexture(source, scaleMode, resolution) { @@ -39,7 +40,19 @@ // TODO docs // used to store the actual dimensions of the source + /** + * Used to store the actual width of the source of this texture + * + * @member {number} + * @readOnly + */ this.realWidth = 100; + /** + * Used to store the actual height of the source of this texture + * + * @member {number} + * @readOnly + */ this.realHeight = 100; /** @@ -96,6 +109,7 @@ this.imageUrl = null; /** + * Wether or not the texture is a power of two, try to use power of two textures as much as you can * @member {boolean} * @private */ diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/math/index.js b/src/core/math/index.js index cc176e9..0e7a562 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -3,7 +3,7 @@ */ module.exports = { /** - * @property {number} PI_2 - Math.PI x 2 + * @property {number} PI_2 - Two Pi * @constant * @static */ diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 464edcc..27664c2 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -21,7 +21,10 @@ * And here you have a hundred sprites that will be renderer at the speed of light. * * @class + * @extends Container * @namespace PIXI + * + * @param size {number} The number of images in the SpriteBatch before it flushes. */ function ParticleContainer(size, properties) { @@ -55,7 +58,7 @@ }; /** - * Renders the object using the WebGL renderer + * Renders the container using the WebGL renderer * * @param renderer {WebGLRenderer} The webgl renderer * @private @@ -71,6 +74,13 @@ renderer.plugins.particle.render( this ); }; +/** + * Adds a child to this particle container at a specified index. If the index is out of bounds an error will be thrown + * + * @param child {DisplayObject} The child to add + * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. + */ ParticleContainer.prototype.addChildAt = function (child, index) { // prevent adding self as child diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index abc8317..73eae2e 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -19,6 +19,9 @@ */ function ParticleBuffer(gl, properties, size) { + /** + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; /** @@ -42,7 +45,18 @@ */ this.size = size; + /** + * + * + * @member {Array} + */ this.dynamicProperties = []; + + /** + * + * + * @member {Array} + */ this.staticProperties = []; for (var i = 0; i < properties.length; i++) diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 56213f0..4b46eb0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -75,10 +75,10 @@ WebGLRenderer.registerPlugin('particle', ParticleRenderer); /** - * Sets up the renderer context and necessary buffers. + * When there is a WebGL context change * * @private - * @param gl {WebGLRenderingContext} the current WebGL drawing context + * */ ParticleRenderer.prototype.onContextChange = function () { @@ -164,7 +164,7 @@ /** * Renders the sprite object. * - * @param sprite {Sprite} the sprite to render when using this Particle + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer */ ParticleRenderer.prototype.render = function ( container ) { @@ -247,6 +247,11 @@ container._updateStatic = false; }; +/** + * Creates one particle buffer for each child in the container we want to render and updates internal properties + * + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer + */ ParticleRenderer.prototype.generateBuffers = function ( container ) { var gl = this.renderer.gl, @@ -269,7 +274,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their vertices uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadVerticies = function (children, startIndex, amount, array, stride, offset) { var sprite, @@ -323,7 +336,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their positions uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadPosition = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -347,6 +368,15 @@ }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their rotation uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadRotation = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -363,6 +393,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their Uvs uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadUvs = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -405,6 +444,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their alpha uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadAlpha = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -432,5 +480,3 @@ //TODO implement this! }; - - diff --git a/src/core/particles/webgl/ParticleShader.js b/src/core/particles/webgl/ParticleShader.js index 97836c2..096aef6 100644 --- a/src/core/particles/webgl/ParticleShader.js +++ b/src/core/particles/webgl/ParticleShader.js @@ -2,7 +2,7 @@ /** * @class - * @extends Shader + * @extends TextureShader * @namespace PIXI * @param shaderManager {ShaderManager} The webgl shader manager this shader works for. */ diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index 486f010..e90d550 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -19,6 +19,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ function SpriteRenderer(renderer) @@ -66,7 +67,7 @@ this.positions = new Float32Array(this.vertices); /** - * View on the vertices as a Uint32Array + * Holds the color components * * @member {Uint32Array} */ diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index c547872..f28bdfa 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -9,6 +9,7 @@ * @namespace PIXI * @param source {Image|Canvas} the source object of the texture. * @param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values + * @param resolution {number} the resolution of the texture for devices with different pixel ratios */ function BaseTexture(source, scaleMode, resolution) { @@ -39,7 +40,19 @@ // TODO docs // used to store the actual dimensions of the source + /** + * Used to store the actual width of the source of this texture + * + * @member {number} + * @readOnly + */ this.realWidth = 100; + /** + * Used to store the actual height of the source of this texture + * + * @member {number} + * @readOnly + */ this.realHeight = 100; /** @@ -96,6 +109,7 @@ this.imageUrl = null; /** + * Wether or not the texture is a power of two, try to use power of two textures as much as you can * @member {boolean} * @private */ diff --git a/src/core/textures/RenderTexture.js b/src/core/textures/RenderTexture.js index 9cf5a8e..6a571c8 100644 --- a/src/core/textures/RenderTexture.js +++ b/src/core/textures/RenderTexture.js @@ -343,6 +343,11 @@ }; +/** + * Destroys this texture + * + * @param destroyBase {boolean} Whether to destroy the base texture as well + */ RenderTexture.prototype.destroy = function () { Texture.prototype.destroy.call(this, true); diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/math/index.js b/src/core/math/index.js index cc176e9..0e7a562 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -3,7 +3,7 @@ */ module.exports = { /** - * @property {number} PI_2 - Math.PI x 2 + * @property {number} PI_2 - Two Pi * @constant * @static */ diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 464edcc..27664c2 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -21,7 +21,10 @@ * And here you have a hundred sprites that will be renderer at the speed of light. * * @class + * @extends Container * @namespace PIXI + * + * @param size {number} The number of images in the SpriteBatch before it flushes. */ function ParticleContainer(size, properties) { @@ -55,7 +58,7 @@ }; /** - * Renders the object using the WebGL renderer + * Renders the container using the WebGL renderer * * @param renderer {WebGLRenderer} The webgl renderer * @private @@ -71,6 +74,13 @@ renderer.plugins.particle.render( this ); }; +/** + * Adds a child to this particle container at a specified index. If the index is out of bounds an error will be thrown + * + * @param child {DisplayObject} The child to add + * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. + */ ParticleContainer.prototype.addChildAt = function (child, index) { // prevent adding self as child diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index abc8317..73eae2e 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -19,6 +19,9 @@ */ function ParticleBuffer(gl, properties, size) { + /** + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; /** @@ -42,7 +45,18 @@ */ this.size = size; + /** + * + * + * @member {Array} + */ this.dynamicProperties = []; + + /** + * + * + * @member {Array} + */ this.staticProperties = []; for (var i = 0; i < properties.length; i++) diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 56213f0..4b46eb0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -75,10 +75,10 @@ WebGLRenderer.registerPlugin('particle', ParticleRenderer); /** - * Sets up the renderer context and necessary buffers. + * When there is a WebGL context change * * @private - * @param gl {WebGLRenderingContext} the current WebGL drawing context + * */ ParticleRenderer.prototype.onContextChange = function () { @@ -164,7 +164,7 @@ /** * Renders the sprite object. * - * @param sprite {Sprite} the sprite to render when using this Particle + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer */ ParticleRenderer.prototype.render = function ( container ) { @@ -247,6 +247,11 @@ container._updateStatic = false; }; +/** + * Creates one particle buffer for each child in the container we want to render and updates internal properties + * + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer + */ ParticleRenderer.prototype.generateBuffers = function ( container ) { var gl = this.renderer.gl, @@ -269,7 +274,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their vertices uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadVerticies = function (children, startIndex, amount, array, stride, offset) { var sprite, @@ -323,7 +336,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their positions uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadPosition = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -347,6 +368,15 @@ }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their rotation uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadRotation = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -363,6 +393,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their Uvs uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadUvs = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -405,6 +444,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their alpha uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadAlpha = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -432,5 +480,3 @@ //TODO implement this! }; - - diff --git a/src/core/particles/webgl/ParticleShader.js b/src/core/particles/webgl/ParticleShader.js index 97836c2..096aef6 100644 --- a/src/core/particles/webgl/ParticleShader.js +++ b/src/core/particles/webgl/ParticleShader.js @@ -2,7 +2,7 @@ /** * @class - * @extends Shader + * @extends TextureShader * @namespace PIXI * @param shaderManager {ShaderManager} The webgl shader manager this shader works for. */ diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index 486f010..e90d550 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -19,6 +19,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ function SpriteRenderer(renderer) @@ -66,7 +67,7 @@ this.positions = new Float32Array(this.vertices); /** - * View on the vertices as a Uint32Array + * Holds the color components * * @member {Uint32Array} */ diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index c547872..f28bdfa 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -9,6 +9,7 @@ * @namespace PIXI * @param source {Image|Canvas} the source object of the texture. * @param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values + * @param resolution {number} the resolution of the texture for devices with different pixel ratios */ function BaseTexture(source, scaleMode, resolution) { @@ -39,7 +40,19 @@ // TODO docs // used to store the actual dimensions of the source + /** + * Used to store the actual width of the source of this texture + * + * @member {number} + * @readOnly + */ this.realWidth = 100; + /** + * Used to store the actual height of the source of this texture + * + * @member {number} + * @readOnly + */ this.realHeight = 100; /** @@ -96,6 +109,7 @@ this.imageUrl = null; /** + * Wether or not the texture is a power of two, try to use power of two textures as much as you can * @member {boolean} * @private */ diff --git a/src/core/textures/RenderTexture.js b/src/core/textures/RenderTexture.js index 9cf5a8e..6a571c8 100644 --- a/src/core/textures/RenderTexture.js +++ b/src/core/textures/RenderTexture.js @@ -343,6 +343,11 @@ }; +/** + * Destroys this texture + * + * @param destroyBase {boolean} Whether to destroy the base texture as well + */ RenderTexture.prototype.destroy = function () { Texture.prototype.destroy.call(this, true); diff --git a/src/core/textures/Texture.js b/src/core/textures/Texture.js index ad7f09c..69bfa08 100644 --- a/src/core/textures/Texture.js +++ b/src/core/textures/Texture.js @@ -248,7 +248,7 @@ * @param imageUrl {string} The image url of the texture * @param crossorigin {boolean} Whether requests should be treated as crossorigin * @param scaleMode {number} See {{#crossLink "PIXI/scaleModes:property"}}scaleModes{{/crossLink}} for possible values - * @return Texture + * @return {Texture} The newly created texture */ Texture.fromImage = function (imageUrl, crossorigin, scaleMode) { @@ -263,7 +263,14 @@ return texture; }; - +/** + * Helper function that creates a sprite that will contain a texture from the TextureCache based on the frameId + * The frame ids are created when a Texture packer file has been loaded + * + * @static + * @param frameId {String} The frame Id of the texture in the cache + * @return {Texture} The newly created texture + */ Texture.fromFrame = function (frameId) { var texture = utils.TextureCache[frameId]; diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/math/index.js b/src/core/math/index.js index cc176e9..0e7a562 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -3,7 +3,7 @@ */ module.exports = { /** - * @property {number} PI_2 - Math.PI x 2 + * @property {number} PI_2 - Two Pi * @constant * @static */ diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 464edcc..27664c2 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -21,7 +21,10 @@ * And here you have a hundred sprites that will be renderer at the speed of light. * * @class + * @extends Container * @namespace PIXI + * + * @param size {number} The number of images in the SpriteBatch before it flushes. */ function ParticleContainer(size, properties) { @@ -55,7 +58,7 @@ }; /** - * Renders the object using the WebGL renderer + * Renders the container using the WebGL renderer * * @param renderer {WebGLRenderer} The webgl renderer * @private @@ -71,6 +74,13 @@ renderer.plugins.particle.render( this ); }; +/** + * Adds a child to this particle container at a specified index. If the index is out of bounds an error will be thrown + * + * @param child {DisplayObject} The child to add + * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. + */ ParticleContainer.prototype.addChildAt = function (child, index) { // prevent adding self as child diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index abc8317..73eae2e 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -19,6 +19,9 @@ */ function ParticleBuffer(gl, properties, size) { + /** + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; /** @@ -42,7 +45,18 @@ */ this.size = size; + /** + * + * + * @member {Array} + */ this.dynamicProperties = []; + + /** + * + * + * @member {Array} + */ this.staticProperties = []; for (var i = 0; i < properties.length; i++) diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 56213f0..4b46eb0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -75,10 +75,10 @@ WebGLRenderer.registerPlugin('particle', ParticleRenderer); /** - * Sets up the renderer context and necessary buffers. + * When there is a WebGL context change * * @private - * @param gl {WebGLRenderingContext} the current WebGL drawing context + * */ ParticleRenderer.prototype.onContextChange = function () { @@ -164,7 +164,7 @@ /** * Renders the sprite object. * - * @param sprite {Sprite} the sprite to render when using this Particle + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer */ ParticleRenderer.prototype.render = function ( container ) { @@ -247,6 +247,11 @@ container._updateStatic = false; }; +/** + * Creates one particle buffer for each child in the container we want to render and updates internal properties + * + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer + */ ParticleRenderer.prototype.generateBuffers = function ( container ) { var gl = this.renderer.gl, @@ -269,7 +274,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their vertices uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadVerticies = function (children, startIndex, amount, array, stride, offset) { var sprite, @@ -323,7 +336,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their positions uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadPosition = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -347,6 +368,15 @@ }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their rotation uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadRotation = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -363,6 +393,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their Uvs uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadUvs = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -405,6 +444,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their alpha uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadAlpha = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -432,5 +480,3 @@ //TODO implement this! }; - - diff --git a/src/core/particles/webgl/ParticleShader.js b/src/core/particles/webgl/ParticleShader.js index 97836c2..096aef6 100644 --- a/src/core/particles/webgl/ParticleShader.js +++ b/src/core/particles/webgl/ParticleShader.js @@ -2,7 +2,7 @@ /** * @class - * @extends Shader + * @extends TextureShader * @namespace PIXI * @param shaderManager {ShaderManager} The webgl shader manager this shader works for. */ diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index 486f010..e90d550 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -19,6 +19,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ function SpriteRenderer(renderer) @@ -66,7 +67,7 @@ this.positions = new Float32Array(this.vertices); /** - * View on the vertices as a Uint32Array + * Holds the color components * * @member {Uint32Array} */ diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index c547872..f28bdfa 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -9,6 +9,7 @@ * @namespace PIXI * @param source {Image|Canvas} the source object of the texture. * @param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values + * @param resolution {number} the resolution of the texture for devices with different pixel ratios */ function BaseTexture(source, scaleMode, resolution) { @@ -39,7 +40,19 @@ // TODO docs // used to store the actual dimensions of the source + /** + * Used to store the actual width of the source of this texture + * + * @member {number} + * @readOnly + */ this.realWidth = 100; + /** + * Used to store the actual height of the source of this texture + * + * @member {number} + * @readOnly + */ this.realHeight = 100; /** @@ -96,6 +109,7 @@ this.imageUrl = null; /** + * Wether or not the texture is a power of two, try to use power of two textures as much as you can * @member {boolean} * @private */ diff --git a/src/core/textures/RenderTexture.js b/src/core/textures/RenderTexture.js index 9cf5a8e..6a571c8 100644 --- a/src/core/textures/RenderTexture.js +++ b/src/core/textures/RenderTexture.js @@ -343,6 +343,11 @@ }; +/** + * Destroys this texture + * + * @param destroyBase {boolean} Whether to destroy the base texture as well + */ RenderTexture.prototype.destroy = function () { Texture.prototype.destroy.call(this, true); diff --git a/src/core/textures/Texture.js b/src/core/textures/Texture.js index ad7f09c..69bfa08 100644 --- a/src/core/textures/Texture.js +++ b/src/core/textures/Texture.js @@ -248,7 +248,7 @@ * @param imageUrl {string} The image url of the texture * @param crossorigin {boolean} Whether requests should be treated as crossorigin * @param scaleMode {number} See {{#crossLink "PIXI/scaleModes:property"}}scaleModes{{/crossLink}} for possible values - * @return Texture + * @return {Texture} The newly created texture */ Texture.fromImage = function (imageUrl, crossorigin, scaleMode) { @@ -263,7 +263,14 @@ return texture; }; - +/** + * Helper function that creates a sprite that will contain a texture from the TextureCache based on the frameId + * The frame ids are created when a Texture packer file has been loaded + * + * @static + * @param frameId {String} The frame Id of the texture in the cache + * @return {Texture} The newly created texture + */ Texture.fromFrame = function (frameId) { var texture = utils.TextureCache[frameId]; diff --git a/src/core/textures/TextureUvs.js b/src/core/textures/TextureUvs.js index fd1682f..cdfbbd7 100644 --- a/src/core/textures/TextureUvs.js +++ b/src/core/textures/TextureUvs.js @@ -1,4 +1,9 @@ +/** + * A standard object to store the Uvs of a texture + * + * @class + */ function TextureUvs() { this.x0 = 0; @@ -16,6 +21,13 @@ module.exports = TextureUvs; +/** + * Sets the texture Uvs based on the given frame information + * @param frame {Rectangle} + * @param baseFrame {Rectangle} + * @param rotate {boolean} Whether or not the frame is rotated + * @private + */ TextureUvs.prototype.set = function (frame, baseFrame, rotate) { var tw = baseFrame.width; diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/math/index.js b/src/core/math/index.js index cc176e9..0e7a562 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -3,7 +3,7 @@ */ module.exports = { /** - * @property {number} PI_2 - Math.PI x 2 + * @property {number} PI_2 - Two Pi * @constant * @static */ diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 464edcc..27664c2 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -21,7 +21,10 @@ * And here you have a hundred sprites that will be renderer at the speed of light. * * @class + * @extends Container * @namespace PIXI + * + * @param size {number} The number of images in the SpriteBatch before it flushes. */ function ParticleContainer(size, properties) { @@ -55,7 +58,7 @@ }; /** - * Renders the object using the WebGL renderer + * Renders the container using the WebGL renderer * * @param renderer {WebGLRenderer} The webgl renderer * @private @@ -71,6 +74,13 @@ renderer.plugins.particle.render( this ); }; +/** + * Adds a child to this particle container at a specified index. If the index is out of bounds an error will be thrown + * + * @param child {DisplayObject} The child to add + * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. + */ ParticleContainer.prototype.addChildAt = function (child, index) { // prevent adding self as child diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index abc8317..73eae2e 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -19,6 +19,9 @@ */ function ParticleBuffer(gl, properties, size) { + /** + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; /** @@ -42,7 +45,18 @@ */ this.size = size; + /** + * + * + * @member {Array} + */ this.dynamicProperties = []; + + /** + * + * + * @member {Array} + */ this.staticProperties = []; for (var i = 0; i < properties.length; i++) diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 56213f0..4b46eb0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -75,10 +75,10 @@ WebGLRenderer.registerPlugin('particle', ParticleRenderer); /** - * Sets up the renderer context and necessary buffers. + * When there is a WebGL context change * * @private - * @param gl {WebGLRenderingContext} the current WebGL drawing context + * */ ParticleRenderer.prototype.onContextChange = function () { @@ -164,7 +164,7 @@ /** * Renders the sprite object. * - * @param sprite {Sprite} the sprite to render when using this Particle + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer */ ParticleRenderer.prototype.render = function ( container ) { @@ -247,6 +247,11 @@ container._updateStatic = false; }; +/** + * Creates one particle buffer for each child in the container we want to render and updates internal properties + * + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer + */ ParticleRenderer.prototype.generateBuffers = function ( container ) { var gl = this.renderer.gl, @@ -269,7 +274,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their vertices uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadVerticies = function (children, startIndex, amount, array, stride, offset) { var sprite, @@ -323,7 +336,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their positions uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadPosition = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -347,6 +368,15 @@ }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their rotation uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadRotation = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -363,6 +393,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their Uvs uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadUvs = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -405,6 +444,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their alpha uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadAlpha = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -432,5 +480,3 @@ //TODO implement this! }; - - diff --git a/src/core/particles/webgl/ParticleShader.js b/src/core/particles/webgl/ParticleShader.js index 97836c2..096aef6 100644 --- a/src/core/particles/webgl/ParticleShader.js +++ b/src/core/particles/webgl/ParticleShader.js @@ -2,7 +2,7 @@ /** * @class - * @extends Shader + * @extends TextureShader * @namespace PIXI * @param shaderManager {ShaderManager} The webgl shader manager this shader works for. */ diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index 486f010..e90d550 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -19,6 +19,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ function SpriteRenderer(renderer) @@ -66,7 +67,7 @@ this.positions = new Float32Array(this.vertices); /** - * View on the vertices as a Uint32Array + * Holds the color components * * @member {Uint32Array} */ diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index c547872..f28bdfa 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -9,6 +9,7 @@ * @namespace PIXI * @param source {Image|Canvas} the source object of the texture. * @param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values + * @param resolution {number} the resolution of the texture for devices with different pixel ratios */ function BaseTexture(source, scaleMode, resolution) { @@ -39,7 +40,19 @@ // TODO docs // used to store the actual dimensions of the source + /** + * Used to store the actual width of the source of this texture + * + * @member {number} + * @readOnly + */ this.realWidth = 100; + /** + * Used to store the actual height of the source of this texture + * + * @member {number} + * @readOnly + */ this.realHeight = 100; /** @@ -96,6 +109,7 @@ this.imageUrl = null; /** + * Wether or not the texture is a power of two, try to use power of two textures as much as you can * @member {boolean} * @private */ diff --git a/src/core/textures/RenderTexture.js b/src/core/textures/RenderTexture.js index 9cf5a8e..6a571c8 100644 --- a/src/core/textures/RenderTexture.js +++ b/src/core/textures/RenderTexture.js @@ -343,6 +343,11 @@ }; +/** + * Destroys this texture + * + * @param destroyBase {boolean} Whether to destroy the base texture as well + */ RenderTexture.prototype.destroy = function () { Texture.prototype.destroy.call(this, true); diff --git a/src/core/textures/Texture.js b/src/core/textures/Texture.js index ad7f09c..69bfa08 100644 --- a/src/core/textures/Texture.js +++ b/src/core/textures/Texture.js @@ -248,7 +248,7 @@ * @param imageUrl {string} The image url of the texture * @param crossorigin {boolean} Whether requests should be treated as crossorigin * @param scaleMode {number} See {{#crossLink "PIXI/scaleModes:property"}}scaleModes{{/crossLink}} for possible values - * @return Texture + * @return {Texture} The newly created texture */ Texture.fromImage = function (imageUrl, crossorigin, scaleMode) { @@ -263,7 +263,14 @@ return texture; }; - +/** + * Helper function that creates a sprite that will contain a texture from the TextureCache based on the frameId + * The frame ids are created when a Texture packer file has been loaded + * + * @static + * @param frameId {String} The frame Id of the texture in the cache + * @return {Texture} The newly created texture + */ Texture.fromFrame = function (frameId) { var texture = utils.TextureCache[frameId]; diff --git a/src/core/textures/TextureUvs.js b/src/core/textures/TextureUvs.js index fd1682f..cdfbbd7 100644 --- a/src/core/textures/TextureUvs.js +++ b/src/core/textures/TextureUvs.js @@ -1,4 +1,9 @@ +/** + * A standard object to store the Uvs of a texture + * + * @class + */ function TextureUvs() { this.x0 = 0; @@ -16,6 +21,13 @@ module.exports = TextureUvs; +/** + * Sets the texture Uvs based on the given frame information + * @param frame {Rectangle} + * @param baseFrame {Rectangle} + * @param rotate {boolean} Whether or not the frame is rotated + * @private + */ TextureUvs.prototype.set = function (frame, baseFrame, rotate) { var tw = baseFrame.width; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index f6b72c7..7ea8738 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -97,6 +97,10 @@ } }; +/** + * Destroys this texture + * + */ VideoBaseTexture.prototype.destroy = function () { if (this.source && this.source._pixiId) diff --git a/src/core/graphics/GraphicsData.js b/src/core/graphics/GraphicsData.js index 18e3b5c..809d8c3 100644 --- a/src/core/graphics/GraphicsData.js +++ b/src/core/graphics/GraphicsData.js @@ -13,17 +13,52 @@ */ function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) { + /* + * @member {number} the width of the line to draw + */ this.lineWidth = lineWidth; + + /* + * @member {number} the color of the line to draw + */ this.lineColor = lineColor; + /* + * @member {number} the alpha of the line to draw + */ this.lineAlpha = lineAlpha; + /* + * @member {number} cached tint of the line to draw + */ this._lineTint = lineColor; + /* + * @member {number} the color of the fill + */ this.fillColor = fillColor; + + /* + * @member {number} the alpha of the fill + */ this.fillAlpha = fillAlpha; + + /* + * @member {number} cached tint of the fill + */ this._fillTint = fillColor; + + /* + * @member {boolean} whether or not the shape is filled with a colour + */ this.fill = fill; + /* + * @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw. + */ this.shape = shape; + + /* + * @member {number} The type of the shape, see the Const.Shapes file for all the existing types, + */ this.type = shape.type; } diff --git a/src/core/graphics/webgl/WebGLGraphicsData.js b/src/core/graphics/webgl/WebGLGraphicsData.js index 41be102..71a52c8 100644 --- a/src/core/graphics/webgl/WebGLGraphicsData.js +++ b/src/core/graphics/webgl/WebGLGraphicsData.js @@ -1,18 +1,55 @@ /** - * @class + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @param gl {WebGLRenderingContext} the current WebGL drawing context * @private */ function WebGLGraphicsData(gl) { + + /* + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; //TODO does this need to be split before uploding?? + /* + * @member {Array} an array of color components (r,g,b) + */ this.color = [0,0,0]; // color split! + + /* + * @member {Array} an array of points to draw + */ this.points = []; + + /* + * @member {Array} the indices of the vertices + */ this.indices = []; + /* + * @member {WebGLBuffer} the main buffer + */ this.buffer = gl.createBuffer(); + + /* + * @member {WebGLBuffer} the index buffer + */ this.indexBuffer = gl.createBuffer(); + + /* + * @member {number} todo @alvin + */ this.mode = 1; + + /* + * @member {number} The alpha of the graphics + */ this.alpha = 1; + + /* + * @member {boolean} Whether this graphics is dirty or not + */ this.dirty = true; } @@ -20,7 +57,7 @@ module.exports = WebGLGraphicsData; /** - * + * Resets the vertices and the indices */ WebGLGraphicsData.prototype.reset = function () { this.points = []; @@ -28,7 +65,7 @@ }; /** - * + * Binds the buffers and uploads the data */ WebGLGraphicsData.prototype.upload = function () { var gl = this.gl; diff --git a/src/core/math/index.js b/src/core/math/index.js index cc176e9..0e7a562 100644 --- a/src/core/math/index.js +++ b/src/core/math/index.js @@ -3,7 +3,7 @@ */ module.exports = { /** - * @property {number} PI_2 - Math.PI x 2 + * @property {number} PI_2 - Two Pi * @constant * @static */ diff --git a/src/core/particles/ParticleContainer.js b/src/core/particles/ParticleContainer.js index 464edcc..27664c2 100644 --- a/src/core/particles/ParticleContainer.js +++ b/src/core/particles/ParticleContainer.js @@ -21,7 +21,10 @@ * And here you have a hundred sprites that will be renderer at the speed of light. * * @class + * @extends Container * @namespace PIXI + * + * @param size {number} The number of images in the SpriteBatch before it flushes. */ function ParticleContainer(size, properties) { @@ -55,7 +58,7 @@ }; /** - * Renders the object using the WebGL renderer + * Renders the container using the WebGL renderer * * @param renderer {WebGLRenderer} The webgl renderer * @private @@ -71,6 +74,13 @@ renderer.plugins.particle.render( this ); }; +/** + * Adds a child to this particle container at a specified index. If the index is out of bounds an error will be thrown + * + * @param child {DisplayObject} The child to add + * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. + */ ParticleContainer.prototype.addChildAt = function (child, index) { // prevent adding self as child diff --git a/src/core/particles/webgl/ParticleBuffer.js b/src/core/particles/webgl/ParticleBuffer.js index abc8317..73eae2e 100644 --- a/src/core/particles/webgl/ParticleBuffer.js +++ b/src/core/particles/webgl/ParticleBuffer.js @@ -19,6 +19,9 @@ */ function ParticleBuffer(gl, properties, size) { + /** + * @member {WebGLRenderingContext} the current WebGL drawing context + */ this.gl = gl; /** @@ -42,7 +45,18 @@ */ this.size = size; + /** + * + * + * @member {Array} + */ this.dynamicProperties = []; + + /** + * + * + * @member {Array} + */ this.staticProperties = []; for (var i = 0; i < properties.length; i++) diff --git a/src/core/particles/webgl/ParticleRenderer.js b/src/core/particles/webgl/ParticleRenderer.js index 56213f0..4b46eb0 100644 --- a/src/core/particles/webgl/ParticleRenderer.js +++ b/src/core/particles/webgl/ParticleRenderer.js @@ -75,10 +75,10 @@ WebGLRenderer.registerPlugin('particle', ParticleRenderer); /** - * Sets up the renderer context and necessary buffers. + * When there is a WebGL context change * * @private - * @param gl {WebGLRenderingContext} the current WebGL drawing context + * */ ParticleRenderer.prototype.onContextChange = function () { @@ -164,7 +164,7 @@ /** * Renders the sprite object. * - * @param sprite {Sprite} the sprite to render when using this Particle + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer */ ParticleRenderer.prototype.render = function ( container ) { @@ -247,6 +247,11 @@ container._updateStatic = false; }; +/** + * Creates one particle buffer for each child in the container we want to render and updates internal properties + * + * @param container {Container || Sprite} the sprite to render using this ParticleRenderer + */ ParticleRenderer.prototype.generateBuffers = function ( container ) { var gl = this.renderer.gl, @@ -269,7 +274,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their vertices uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadVerticies = function (children, startIndex, amount, array, stride, offset) { var sprite, @@ -323,7 +336,15 @@ }; - +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their positions uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadPosition = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -347,6 +368,15 @@ }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their rotation uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadRotation = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -363,6 +393,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their Uvs uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadUvs = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -405,6 +444,15 @@ } }; +/** + * + * @param children {Array} the array of display objects to render + * @param startIndex {number} the index to start from in the children array + * @param amount {number} the amount of children that will have their alpha uploaded + * @param array {Array} + * @param stride {number} + * @param offset {number} + */ ParticleRenderer.prototype.uploadAlpha = function (children,startIndex, amount, array, stride, offset) { for (var i = 0; i < amount; i++) @@ -432,5 +480,3 @@ //TODO implement this! }; - - diff --git a/src/core/particles/webgl/ParticleShader.js b/src/core/particles/webgl/ParticleShader.js index 97836c2..096aef6 100644 --- a/src/core/particles/webgl/ParticleShader.js +++ b/src/core/particles/webgl/ParticleShader.js @@ -2,7 +2,7 @@ /** * @class - * @extends Shader + * @extends TextureShader * @namespace PIXI * @param shaderManager {ShaderManager} The webgl shader manager this shader works for. */ diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index 486f010..e90d550 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -19,6 +19,7 @@ * @class * @private * @namespace PIXI + * @extends ObjectRenderer * @param renderer {WebGLRenderer} The renderer this sprite batch works for. */ function SpriteRenderer(renderer) @@ -66,7 +67,7 @@ this.positions = new Float32Array(this.vertices); /** - * View on the vertices as a Uint32Array + * Holds the color components * * @member {Uint32Array} */ diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index c547872..f28bdfa 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -9,6 +9,7 @@ * @namespace PIXI * @param source {Image|Canvas} the source object of the texture. * @param [scaleMode=scaleModes.DEFAULT] {number} See {@link SCALE_MODES} for possible values + * @param resolution {number} the resolution of the texture for devices with different pixel ratios */ function BaseTexture(source, scaleMode, resolution) { @@ -39,7 +40,19 @@ // TODO docs // used to store the actual dimensions of the source + /** + * Used to store the actual width of the source of this texture + * + * @member {number} + * @readOnly + */ this.realWidth = 100; + /** + * Used to store the actual height of the source of this texture + * + * @member {number} + * @readOnly + */ this.realHeight = 100; /** @@ -96,6 +109,7 @@ this.imageUrl = null; /** + * Wether or not the texture is a power of two, try to use power of two textures as much as you can * @member {boolean} * @private */ diff --git a/src/core/textures/RenderTexture.js b/src/core/textures/RenderTexture.js index 9cf5a8e..6a571c8 100644 --- a/src/core/textures/RenderTexture.js +++ b/src/core/textures/RenderTexture.js @@ -343,6 +343,11 @@ }; +/** + * Destroys this texture + * + * @param destroyBase {boolean} Whether to destroy the base texture as well + */ RenderTexture.prototype.destroy = function () { Texture.prototype.destroy.call(this, true); diff --git a/src/core/textures/Texture.js b/src/core/textures/Texture.js index ad7f09c..69bfa08 100644 --- a/src/core/textures/Texture.js +++ b/src/core/textures/Texture.js @@ -248,7 +248,7 @@ * @param imageUrl {string} The image url of the texture * @param crossorigin {boolean} Whether requests should be treated as crossorigin * @param scaleMode {number} See {{#crossLink "PIXI/scaleModes:property"}}scaleModes{{/crossLink}} for possible values - * @return Texture + * @return {Texture} The newly created texture */ Texture.fromImage = function (imageUrl, crossorigin, scaleMode) { @@ -263,7 +263,14 @@ return texture; }; - +/** + * Helper function that creates a sprite that will contain a texture from the TextureCache based on the frameId + * The frame ids are created when a Texture packer file has been loaded + * + * @static + * @param frameId {String} The frame Id of the texture in the cache + * @return {Texture} The newly created texture + */ Texture.fromFrame = function (frameId) { var texture = utils.TextureCache[frameId]; diff --git a/src/core/textures/TextureUvs.js b/src/core/textures/TextureUvs.js index fd1682f..cdfbbd7 100644 --- a/src/core/textures/TextureUvs.js +++ b/src/core/textures/TextureUvs.js @@ -1,4 +1,9 @@ +/** + * A standard object to store the Uvs of a texture + * + * @class + */ function TextureUvs() { this.x0 = 0; @@ -16,6 +21,13 @@ module.exports = TextureUvs; +/** + * Sets the texture Uvs based on the given frame information + * @param frame {Rectangle} + * @param baseFrame {Rectangle} + * @param rotate {boolean} Whether or not the frame is rotated + * @private + */ TextureUvs.prototype.set = function (frame, baseFrame, rotate) { var tw = baseFrame.width; diff --git a/src/core/textures/VideoBaseTexture.js b/src/core/textures/VideoBaseTexture.js index f6b72c7..7ea8738 100644 --- a/src/core/textures/VideoBaseTexture.js +++ b/src/core/textures/VideoBaseTexture.js @@ -97,6 +97,10 @@ } }; +/** + * Destroys this texture + * + */ VideoBaseTexture.prototype.destroy = function () { if (this.source && this.source._pixiId) diff --git a/src/extras/Strip.js b/src/extras/Strip.js index a6fa179..345a10d 100644 --- a/src/extras/Strip.js +++ b/src/extras/Strip.js @@ -21,17 +21,31 @@ */ this.texture = texture; - // set up the main bits.. + /** + * The Uvs of the strip + * + * @member {Float32Array} + */ this.uvs = new Float32Array([0, 1, 1, 1, 1, 0, 0, 1]); + /** + * An array of vertices + * + * @member {Float32Array} + */ this.vertices = new Float32Array([0, 0, 100, 0, 100, 100, 0, 100]); + /** + * The color components + * + * @member {Float32Array} + */ this.colors = new Float32Array([1, 1, 1, 1]); this.indices = new Uint16Array([0, 1, 2, 3]);