diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 5f9e229..24c7e64 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -7,6 +7,10 @@ * A Container represents a collection of display objects. * It is the base class of all display objects that act as a container for other objects. * + *```js + * var container = new PIXI.Container(); + * container.addChild(sprite); + * ``` * @class * @extends DisplayObject * @memberof PIXI diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 5f9e229..24c7e64 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -7,6 +7,10 @@ * A Container represents a collection of display objects. * It is the base class of all display objects that act as a container for other objects. * + *```js + * var container = new PIXI.Container(); + * container.addChild(sprite); + * ``` * @class * @extends DisplayObject * @memberof PIXI diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 5f11fef..dafe4ba 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -30,6 +30,12 @@ WebGLRenderer.registerPlugin('graphics', GraphicsRenderer); +/** + * Called when there is a WebGL context change + * + * @private + * + */ GraphicsRenderer.prototype.onContextChange = function() { diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 5f9e229..24c7e64 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -7,6 +7,10 @@ * A Container represents a collection of display objects. * It is the base class of all display objects that act as a container for other objects. * + *```js + * var container = new PIXI.Container(); + * container.addChild(sprite); + * ``` * @class * @extends DisplayObject * @memberof PIXI diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 5f11fef..dafe4ba 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -30,6 +30,12 @@ WebGLRenderer.registerPlugin('graphics', GraphicsRenderer); +/** + * Called when there is a WebGL context change + * + * @private + * + */ GraphicsRenderer.prototype.onContextChange = function() { diff --git a/src/extras/mesh/Mesh.js b/src/extras/mesh/Mesh.js index b2fda5d..485da9f 100644 --- a/src/extras/mesh/Mesh.js +++ b/src/extras/mesh/Mesh.js @@ -1,14 +1,15 @@ var core = require('../../core'); /** - * + * Base mesh class * @class * @extends Container * @memberof PIXI.extras * @param texture {Texture} The texture to use - * @param width {number} the width - * @param height {number} the height - * + * @param [vertices] {Float32Arrif you want to specify the vertices + * @param [uvs] {Float32Array} if you want to specify the uvs + * @param [indices] {Uint16Array} if you want to specify the indices + * @param [drawMode] {number} the drawMode, can be any of the Mesh.DrawModes consts */ function Mesh(texture, vertices, uvs, indices, drawMode) { @@ -74,7 +75,7 @@ * * @member {number} */ - this.drawMode = drawMode || Mesh.DrawModes.TRIANGLE_Mesh; + this.drawMode = drawMode || Mesh.DrawModes.TRIANGLE_MESH; } // constructor @@ -94,13 +95,6 @@ }; /** - * Creates the buffers and (in the darkness) binds them - * - * @param renderer {WebGLRenderer} a reference to the WebGL renderer - * @private - */ - -/** * Renders the object using the Canvas renderer * * @param renderer {CanvasRenderer} @@ -120,7 +114,7 @@ context.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx, transform.ty); } - if (this.drawMode === Mesh.DrawModes.TRIANGLE_Mesh) + if (this.drawMode === Mesh.DrawModes.TRIANGLE_MESH) { this._renderCanvasTriangleMesh(context); } @@ -131,7 +125,7 @@ }; /** - * Draws the object in TRIANGLE_Mesh mode using canvas + * Draws the object in Triangle Mesh mode using canvas * * @param context {CanvasRenderingContext2D} the current drawing context * @private @@ -181,8 +175,8 @@ * Draws one of the triangles that form this Mesh * * @param context {CanvasRenderingContext2D} the current drawing context - * @param vertices {Float32Array} a reference to the the vertices of the Mesh - * @param uvs {Float32Array} a reference to the the vertices of the Mesh + * @param vertices {Float32Array} a reference to the vertices of the Mesh + * @param uvs {Float32Array} a reference to the uvs of the Mesh * @param index0 {number} the index of the first vertex * @param index1 {number} the index of the second vertex * @param index2 {number} the index of the third vertex @@ -384,10 +378,10 @@ * @static * @constant * @property {object} DrawModes - * @property {number} DrawModes.TRIANGLE_Mesh + * @property {number} DrawModes.TRIANGLE_MESH * @property {number} DrawModes.TRIANGLES */ Mesh.DrawModes = { - TRIANGLE_Mesh: 0, + TRIANGLE_MESH: 0, TRIANGLES: 1 }; diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 5f9e229..24c7e64 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -7,6 +7,10 @@ * A Container represents a collection of display objects. * It is the base class of all display objects that act as a container for other objects. * + *```js + * var container = new PIXI.Container(); + * container.addChild(sprite); + * ``` * @class * @extends DisplayObject * @memberof PIXI diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 5f11fef..dafe4ba 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -30,6 +30,12 @@ WebGLRenderer.registerPlugin('graphics', GraphicsRenderer); +/** + * Called when there is a WebGL context change + * + * @private + * + */ GraphicsRenderer.prototype.onContextChange = function() { diff --git a/src/extras/mesh/Mesh.js b/src/extras/mesh/Mesh.js index b2fda5d..485da9f 100644 --- a/src/extras/mesh/Mesh.js +++ b/src/extras/mesh/Mesh.js @@ -1,14 +1,15 @@ var core = require('../../core'); /** - * + * Base mesh class * @class * @extends Container * @memberof PIXI.extras * @param texture {Texture} The texture to use - * @param width {number} the width - * @param height {number} the height - * + * @param [vertices] {Float32Arrif you want to specify the vertices + * @param [uvs] {Float32Array} if you want to specify the uvs + * @param [indices] {Uint16Array} if you want to specify the indices + * @param [drawMode] {number} the drawMode, can be any of the Mesh.DrawModes consts */ function Mesh(texture, vertices, uvs, indices, drawMode) { @@ -74,7 +75,7 @@ * * @member {number} */ - this.drawMode = drawMode || Mesh.DrawModes.TRIANGLE_Mesh; + this.drawMode = drawMode || Mesh.DrawModes.TRIANGLE_MESH; } // constructor @@ -94,13 +95,6 @@ }; /** - * Creates the buffers and (in the darkness) binds them - * - * @param renderer {WebGLRenderer} a reference to the WebGL renderer - * @private - */ - -/** * Renders the object using the Canvas renderer * * @param renderer {CanvasRenderer} @@ -120,7 +114,7 @@ context.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx, transform.ty); } - if (this.drawMode === Mesh.DrawModes.TRIANGLE_Mesh) + if (this.drawMode === Mesh.DrawModes.TRIANGLE_MESH) { this._renderCanvasTriangleMesh(context); } @@ -131,7 +125,7 @@ }; /** - * Draws the object in TRIANGLE_Mesh mode using canvas + * Draws the object in Triangle Mesh mode using canvas * * @param context {CanvasRenderingContext2D} the current drawing context * @private @@ -181,8 +175,8 @@ * Draws one of the triangles that form this Mesh * * @param context {CanvasRenderingContext2D} the current drawing context - * @param vertices {Float32Array} a reference to the the vertices of the Mesh - * @param uvs {Float32Array} a reference to the the vertices of the Mesh + * @param vertices {Float32Array} a reference to the vertices of the Mesh + * @param uvs {Float32Array} a reference to the uvs of the Mesh * @param index0 {number} the index of the first vertex * @param index1 {number} the index of the second vertex * @param index2 {number} the index of the third vertex @@ -384,10 +378,10 @@ * @static * @constant * @property {object} DrawModes - * @property {number} DrawModes.TRIANGLE_Mesh + * @property {number} DrawModes.TRIANGLE_MESH * @property {number} DrawModes.TRIANGLES */ Mesh.DrawModes = { - TRIANGLE_Mesh: 0, + TRIANGLE_MESH: 0, TRIANGLES: 1 }; diff --git a/src/extras/mesh/Rope.js b/src/extras/mesh/Rope.js index a6cfc44..8119995 100644 --- a/src/extras/mesh/Rope.js +++ b/src/extras/mesh/Rope.js @@ -1,17 +1,25 @@ -var Strip = require('./Mesh'); +var Mesh = require('./Mesh'); /** + * The rope allows you to draw a texture across several points and them manipulate these points + * + *```js + * for (var i = 0; i < 20; i++) { + * points.push(new PIXI.Point(i * 50, 0)); + * }; + * var rope = new PIXI.Rope(PIXI.Texture.fromImage("snake.png"), points); + * ``` * * @class - * @extends Strip + * @extends Mesh * @memberof PIXI.extras * @param {Texture} texture - The texture to use on the rope. - * @param {Array} points - An array of {Point} objects. + * @param {Array} points - An array of {Point} objects to construct this rope. * */ function Rope(texture, points) { - Strip.call(this, texture); + Mesh.call(this, texture); /* * @member {Array} An array of points that determine the rope @@ -43,7 +51,7 @@ // constructor -Rope.prototype = Object.create(Strip.prototype); +Rope.prototype = Object.create(Mesh.prototype); Rope.prototype.constructor = Rope; module.exports = Rope; diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 5f9e229..24c7e64 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -7,6 +7,10 @@ * A Container represents a collection of display objects. * It is the base class of all display objects that act as a container for other objects. * + *```js + * var container = new PIXI.Container(); + * container.addChild(sprite); + * ``` * @class * @extends DisplayObject * @memberof PIXI diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 5f11fef..dafe4ba 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -30,6 +30,12 @@ WebGLRenderer.registerPlugin('graphics', GraphicsRenderer); +/** + * Called when there is a WebGL context change + * + * @private + * + */ GraphicsRenderer.prototype.onContextChange = function() { diff --git a/src/extras/mesh/Mesh.js b/src/extras/mesh/Mesh.js index b2fda5d..485da9f 100644 --- a/src/extras/mesh/Mesh.js +++ b/src/extras/mesh/Mesh.js @@ -1,14 +1,15 @@ var core = require('../../core'); /** - * + * Base mesh class * @class * @extends Container * @memberof PIXI.extras * @param texture {Texture} The texture to use - * @param width {number} the width - * @param height {number} the height - * + * @param [vertices] {Float32Arrif you want to specify the vertices + * @param [uvs] {Float32Array} if you want to specify the uvs + * @param [indices] {Uint16Array} if you want to specify the indices + * @param [drawMode] {number} the drawMode, can be any of the Mesh.DrawModes consts */ function Mesh(texture, vertices, uvs, indices, drawMode) { @@ -74,7 +75,7 @@ * * @member {number} */ - this.drawMode = drawMode || Mesh.DrawModes.TRIANGLE_Mesh; + this.drawMode = drawMode || Mesh.DrawModes.TRIANGLE_MESH; } // constructor @@ -94,13 +95,6 @@ }; /** - * Creates the buffers and (in the darkness) binds them - * - * @param renderer {WebGLRenderer} a reference to the WebGL renderer - * @private - */ - -/** * Renders the object using the Canvas renderer * * @param renderer {CanvasRenderer} @@ -120,7 +114,7 @@ context.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx, transform.ty); } - if (this.drawMode === Mesh.DrawModes.TRIANGLE_Mesh) + if (this.drawMode === Mesh.DrawModes.TRIANGLE_MESH) { this._renderCanvasTriangleMesh(context); } @@ -131,7 +125,7 @@ }; /** - * Draws the object in TRIANGLE_Mesh mode using canvas + * Draws the object in Triangle Mesh mode using canvas * * @param context {CanvasRenderingContext2D} the current drawing context * @private @@ -181,8 +175,8 @@ * Draws one of the triangles that form this Mesh * * @param context {CanvasRenderingContext2D} the current drawing context - * @param vertices {Float32Array} a reference to the the vertices of the Mesh - * @param uvs {Float32Array} a reference to the the vertices of the Mesh + * @param vertices {Float32Array} a reference to the vertices of the Mesh + * @param uvs {Float32Array} a reference to the uvs of the Mesh * @param index0 {number} the index of the first vertex * @param index1 {number} the index of the second vertex * @param index2 {number} the index of the third vertex @@ -384,10 +378,10 @@ * @static * @constant * @property {object} DrawModes - * @property {number} DrawModes.TRIANGLE_Mesh + * @property {number} DrawModes.TRIANGLE_MESH * @property {number} DrawModes.TRIANGLES */ Mesh.DrawModes = { - TRIANGLE_Mesh: 0, + TRIANGLE_MESH: 0, TRIANGLES: 1 }; diff --git a/src/extras/mesh/Rope.js b/src/extras/mesh/Rope.js index a6cfc44..8119995 100644 --- a/src/extras/mesh/Rope.js +++ b/src/extras/mesh/Rope.js @@ -1,17 +1,25 @@ -var Strip = require('./Mesh'); +var Mesh = require('./Mesh'); /** + * The rope allows you to draw a texture across several points and them manipulate these points + * + *```js + * for (var i = 0; i < 20; i++) { + * points.push(new PIXI.Point(i * 50, 0)); + * }; + * var rope = new PIXI.Rope(PIXI.Texture.fromImage("snake.png"), points); + * ``` * * @class - * @extends Strip + * @extends Mesh * @memberof PIXI.extras * @param {Texture} texture - The texture to use on the rope. - * @param {Array} points - An array of {Point} objects. + * @param {Array} points - An array of {Point} objects to construct this rope. * */ function Rope(texture, points) { - Strip.call(this, texture); + Mesh.call(this, texture); /* * @member {Array} An array of points that determine the rope @@ -43,7 +51,7 @@ // constructor -Rope.prototype = Object.create(Strip.prototype); +Rope.prototype = Object.create(Mesh.prototype); Rope.prototype.constructor = Rope; module.exports = Rope; diff --git a/src/extras/mesh/index.js b/src/extras/mesh/index.js index 0d5f004..dd37f87 100644 --- a/src/extras/mesh/index.js +++ b/src/extras/mesh/index.js @@ -9,7 +9,7 @@ * @namespace PIXI.extras */ module.exports = { - Strip: require('./Strip'), + Mesh: require('./Mesh'), Rope: require('./Rope'), MeshRenderer: require('./webgl/MeshRenderer'), MeshShader: require('./webgl/MeshShader') diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 5f9e229..24c7e64 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -7,6 +7,10 @@ * A Container represents a collection of display objects. * It is the base class of all display objects that act as a container for other objects. * + *```js + * var container = new PIXI.Container(); + * container.addChild(sprite); + * ``` * @class * @extends DisplayObject * @memberof PIXI diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index 5f11fef..dafe4ba 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -30,6 +30,12 @@ WebGLRenderer.registerPlugin('graphics', GraphicsRenderer); +/** + * Called when there is a WebGL context change + * + * @private + * + */ GraphicsRenderer.prototype.onContextChange = function() { diff --git a/src/extras/mesh/Mesh.js b/src/extras/mesh/Mesh.js index b2fda5d..485da9f 100644 --- a/src/extras/mesh/Mesh.js +++ b/src/extras/mesh/Mesh.js @@ -1,14 +1,15 @@ var core = require('../../core'); /** - * + * Base mesh class * @class * @extends Container * @memberof PIXI.extras * @param texture {Texture} The texture to use - * @param width {number} the width - * @param height {number} the height - * + * @param [vertices] {Float32Arrif you want to specify the vertices + * @param [uvs] {Float32Array} if you want to specify the uvs + * @param [indices] {Uint16Array} if you want to specify the indices + * @param [drawMode] {number} the drawMode, can be any of the Mesh.DrawModes consts */ function Mesh(texture, vertices, uvs, indices, drawMode) { @@ -74,7 +75,7 @@ * * @member {number} */ - this.drawMode = drawMode || Mesh.DrawModes.TRIANGLE_Mesh; + this.drawMode = drawMode || Mesh.DrawModes.TRIANGLE_MESH; } // constructor @@ -94,13 +95,6 @@ }; /** - * Creates the buffers and (in the darkness) binds them - * - * @param renderer {WebGLRenderer} a reference to the WebGL renderer - * @private - */ - -/** * Renders the object using the Canvas renderer * * @param renderer {CanvasRenderer} @@ -120,7 +114,7 @@ context.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx, transform.ty); } - if (this.drawMode === Mesh.DrawModes.TRIANGLE_Mesh) + if (this.drawMode === Mesh.DrawModes.TRIANGLE_MESH) { this._renderCanvasTriangleMesh(context); } @@ -131,7 +125,7 @@ }; /** - * Draws the object in TRIANGLE_Mesh mode using canvas + * Draws the object in Triangle Mesh mode using canvas * * @param context {CanvasRenderingContext2D} the current drawing context * @private @@ -181,8 +175,8 @@ * Draws one of the triangles that form this Mesh * * @param context {CanvasRenderingContext2D} the current drawing context - * @param vertices {Float32Array} a reference to the the vertices of the Mesh - * @param uvs {Float32Array} a reference to the the vertices of the Mesh + * @param vertices {Float32Array} a reference to the vertices of the Mesh + * @param uvs {Float32Array} a reference to the uvs of the Mesh * @param index0 {number} the index of the first vertex * @param index1 {number} the index of the second vertex * @param index2 {number} the index of the third vertex @@ -384,10 +378,10 @@ * @static * @constant * @property {object} DrawModes - * @property {number} DrawModes.TRIANGLE_Mesh + * @property {number} DrawModes.TRIANGLE_MESH * @property {number} DrawModes.TRIANGLES */ Mesh.DrawModes = { - TRIANGLE_Mesh: 0, + TRIANGLE_MESH: 0, TRIANGLES: 1 }; diff --git a/src/extras/mesh/Rope.js b/src/extras/mesh/Rope.js index a6cfc44..8119995 100644 --- a/src/extras/mesh/Rope.js +++ b/src/extras/mesh/Rope.js @@ -1,17 +1,25 @@ -var Strip = require('./Mesh'); +var Mesh = require('./Mesh'); /** + * The rope allows you to draw a texture across several points and them manipulate these points + * + *```js + * for (var i = 0; i < 20; i++) { + * points.push(new PIXI.Point(i * 50, 0)); + * }; + * var rope = new PIXI.Rope(PIXI.Texture.fromImage("snake.png"), points); + * ``` * * @class - * @extends Strip + * @extends Mesh * @memberof PIXI.extras * @param {Texture} texture - The texture to use on the rope. - * @param {Array} points - An array of {Point} objects. + * @param {Array} points - An array of {Point} objects to construct this rope. * */ function Rope(texture, points) { - Strip.call(this, texture); + Mesh.call(this, texture); /* * @member {Array} An array of points that determine the rope @@ -43,7 +51,7 @@ // constructor -Rope.prototype = Object.create(Strip.prototype); +Rope.prototype = Object.create(Mesh.prototype); Rope.prototype.constructor = Rope; module.exports = Rope; diff --git a/src/extras/mesh/index.js b/src/extras/mesh/index.js index 0d5f004..dd37f87 100644 --- a/src/extras/mesh/index.js +++ b/src/extras/mesh/index.js @@ -9,7 +9,7 @@ * @namespace PIXI.extras */ module.exports = { - Strip: require('./Strip'), + Mesh: require('./Mesh'), Rope: require('./Rope'), MeshRenderer: require('./webgl/MeshRenderer'), MeshShader: require('./webgl/MeshShader') diff --git a/src/extras/mesh/webgl/MeshRenderer.js b/src/extras/mesh/webgl/MeshRenderer.js index 594a276..5eaabce 100644 --- a/src/extras/mesh/webgl/MeshRenderer.js +++ b/src/extras/mesh/webgl/MeshRenderer.js @@ -64,7 +64,7 @@ /** * Renders the sprite object. * - * @param sprite {Sprite} the sprite to render when using this spritebatch + * @param mesh {Mesh} the mesh to render */ MeshRenderer.prototype.render = function (mesh) { @@ -151,6 +151,10 @@ }; +/** + * Prepares all the buffers to render this mesh + * @param mesh {Mesh} the mesh to render + */ MeshRenderer.prototype._initWebGL = function (mesh) { // build the strip! @@ -176,7 +180,7 @@ /** - * Renders the content and empties the current batch. + * Empties the current batch. * */ MeshRenderer.prototype.flush = function () @@ -185,7 +189,7 @@ }; /** - * Starts a new sprite batch. + * Starts a new mesh renderer. * */ MeshRenderer.prototype.start = function () @@ -196,14 +200,14 @@ this.renderer.shaderManager.setShader(shader); // dont need to upload! - //gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indicies); + //gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indices); // this.s }; /** - * Destroys the SpriteBatch. + * Destroys the Mesh renderer * */ MeshRenderer.prototype.destroy = function ()